473,411 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Unexplained error when databinding

I am using a DataSet as the DataSource of a DataList in my code. The SQL
used to get the data from the database begins with:
SELECT
members.organization,artists.artist,artists.email, artists.website,members.email
FROM members INNER JOIN artists ON members.memberid=artists.memberid WHERE
Notice that both tables involved in the SELECT statement have a field named
email. First, I do not know how to specify which one I want in my
databinding expressions (I tried DataItem.artists.email and
DataItem.members.email, but that gave me an error too). Second, I know that
my DataSet is getting filled correctly because my first databinding
expression worked (see line 71 in the error). My error is as follows:
Server Error in '/' Application.
--------------------------------------------------------------------------------

DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with
the name email.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: DataBinder.Eval:
'System.Data.DataRowView' does not contain a property with the name email.

Source Error:

Line 70: <ItemTemplate>
Line 71: <asp:Label id=lblOrganization1 runat="server" Width="175px"
text='<%# DataBinder.Eval(Container, "DataItem.organization")
%>'></asp:Label>
Line 72: <asp:HyperLink id="lnkPresenterEmail1" runat="server"
Width="175px" text='<%# DataBinder.Eval(Container, "DataItem.email") %>'
NavigateUrl='<%# DataBinder.Eval(Container, "DataItem.email","MAILTO:{0}")
%>' Target="_blank"></asp:HyperLink>
Line 73: <asp:Label id=lblArtist1 runat="server" Width="125" text='<%#
DataBinder.Eval(Container, "DataItem.artist") %>'></asp:Label>
Line 74: <asp:HyperLink id=lnkEmail1 runat="server" Width="175"
text='<%# DataBinder.Eval(Container, "DataItem.email") %>' NavigateUrl='<%#
DataBinder.Eval(Container, "DataItem.email","MAILTO:{0}") %>'
Target="_blank"></asp:HyperLink>

Source File: D:\Clients\12654\papresenters.org\papresenters.org \search.aspx
Line: 72

Stack Trace:

[HttpException (0x80004005): DataBinder.Eval: 'System.Data.DataRowView' does
not contain a property with the name email.]
System.Web.UI.DataBinder.GetPropertyValue(Object container, String
propName) +146
System.Web.UI.DataBinder.Eval(Object container, String[] expressionParts)
+71
System.Web.UI.DataBinder.Eval(Object container, String expression) +82
ASP.search_aspx.__DataBind__control34(Object sender, EventArgs e) in
D:\Clients\12654\papresenters.org\papresenters.org \search.aspx:72
System.Web.UI.Control.OnDataBinding(EventArgs e) +66
System.Web.UI.Control.DataBind() +26
System.Web.UI.Control.DataBind() +86
System.Web.UI.WebControls.DataList.CreateItem(Int3 2 itemIndex,
ListItemType itemType, Boolean dataBind, Object dataItem) +127
System.Web.UI.WebControls.DataList.CreateControlHi erarchy(Boolean
useDataSource) +683
System.Web.UI.WebControls.BaseDataList.OnDataBindi ng(EventArgs e) +48
System.Web.UI.WebControls.BaseDataList.DataBind() +23
PAPresenters.search.btnSearch_Click(Object sender, EventArgs e)
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET
Version:1.1.4322.2300

Can anyone help me with this? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 21 '05 #1
5 4506
ng
The reason you aren't finding 'email' is because SQL databases assign an
arbitrary column name if you have two matching names, or they leave the
qualifier in the name, such as artists.email and members.email. Try
assigning new names to the columns in your SQL statement, like "select
members.email m_email, artists.email a_email" and then use the new
column names in your binding.

Tom
Nathan Sokalski wrote:
I am using a DataSet as the DataSource of a DataList in my code. The SQL
used to get the data from the database begins with:
SELECT
members.organization,artists.artist,artists.email ,artists.website,members.email
FROM members INNER JOIN artists ON members.memberid=artists.memberid WHERE
Notice that both tables involved in the SELECT statement have a field named
email. First, I do not know how to specify which one I want in my
databinding expressions (I tried DataItem.artists.email and
DataItem.members.email, but that gave me an error too). Second, I know that
my DataSet is getting filled correctly because my first databinding
expression worked (see line 71 in the error). My error is as follows:
Server Error in '/' Application.
--------------------------------------------------------------------------------

DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with
the name email.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: DataBinder.Eval:
'System.Data.DataRowView' does not contain a property with the name email.

Source Error:

Line 70: <ItemTemplate>
Line 71: <asp:Label id=lblOrganization1 runat="server" Width="175px"
text='<%# DataBinder.Eval(Container, "DataItem.organization")
%>'></asp:Label>
Line 72: <asp:HyperLink id="lnkPresenterEmail1" runat="server"
Width="175px" text='<%# DataBinder.Eval(Container, "DataItem.email") %>'
NavigateUrl='<%# DataBinder.Eval(Container, "DataItem.email","MAILTO:{0}")
%>' Target="_blank"></asp:HyperLink>
Line 73: <asp:Label id=lblArtist1 runat="server" Width="125" text='<%#
DataBinder.Eval(Container, "DataItem.artist") %>'></asp:Label>
Line 74: <asp:HyperLink id=lnkEmail1 runat="server" Width="175"
text='<%# DataBinder.Eval(Container, "DataItem.email") %>' NavigateUrl='<%#
DataBinder.Eval(Container, "DataItem.email","MAILTO:{0}") %>'
Target="_blank"></asp:HyperLink>

Source File: D:\Clients\12654\papresenters.org\papresenters.org \search.aspx
Line: 72

Stack Trace:

[HttpException (0x80004005): DataBinder.Eval: 'System.Data.DataRowView' does
not contain a property with the name email.]
System.Web.UI.DataBinder.GetPropertyValue(Object container, String
propName) +146
System.Web.UI.DataBinder.Eval(Object container, String[] expressionParts)
+71
System.Web.UI.DataBinder.Eval(Object container, String expression) +82
ASP.search_aspx.__DataBind__control34(Object sender, EventArgs e) in
D:\Clients\12654\papresenters.org\papresenters.or g\search.aspx:72
System.Web.UI.Control.OnDataBinding(EventArgs e) +66
System.Web.UI.Control.DataBind() +26
System.Web.UI.Control.DataBind() +86
System.Web.UI.WebControls.DataList.CreateItem(Int3 2 itemIndex,
ListItemType itemType, Boolean dataBind, Object dataItem) +127
System.Web.UI.WebControls.DataList.CreateControlHi erarchy(Boolean
useDataSource) +683
System.Web.UI.WebControls.BaseDataList.OnDataBindi ng(EventArgs e) +48
System.Web.UI.WebControls.BaseDataList.DataBind() +23
PAPresenters.search.btnSearch_Click(Object sender, EventArgs e)
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET
Version:1.1.4322.2300

Can anyone help me with this? Thanks.

Nov 21 '05 #2
Bob
Nathan:

Or you could just rename the fields in the database to MEmail and AEmail

Bob
Nov 21 '05 #3
Bob
Nathan:

Or you could rename the fields in the database tables to MEmail and AEmail.

Dont forget to clean up the garbage code left behind in the "Windows Form
Designer Generated Code.

Seems to be a problem with VS not doing it when you regenerate the DA's

Today I cleaned up some 2000 lines of code in there. Big diff in
performance.

Bob

"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:O7*************@TK2MSFTNGP10.phx.gbl...
I am using a DataSet as the DataSource of a DataList in my code. The SQL
used to get the data from the database begins with:
SELECT
members.organization,artists.artist,artists.email, artists.website,members.email
FROM members INNER JOIN artists ON members.memberid=artists.memberid WHERE
Notice that both tables involved in the SELECT statement have a field
named email. First, I do not know how to specify which one I want in my
databinding expressions (I tried DataItem.artists.email and
DataItem.members.email, but that gave me an error too). Second, I know
that my DataSet is getting filled correctly because my first databinding
expression worked (see line 71 in the error). My error is as follows:
Server Error in '/' Application.
--------------------------------------------------------------------------------

DataBinder.Eval: 'System.Data.DataRowView' does not contain a property
with the name email.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.Web.HttpException: DataBinder.Eval:
'System.Data.DataRowView' does not contain a property with the name email.

Source Error:

Line 70: <ItemTemplate>
Line 71: <asp:Label id=lblOrganization1 runat="server" Width="175px"
text='<%# DataBinder.Eval(Container, "DataItem.organization")
%>'></asp:Label>
Line 72: <asp:HyperLink id="lnkPresenterEmail1" runat="server"
Width="175px" text='<%# DataBinder.Eval(Container, "DataItem.email") %>'
NavigateUrl='<%# DataBinder.Eval(Container, "DataItem.email","MAILTO:{0}")
%>' Target="_blank"></asp:HyperLink>
Line 73: <asp:Label id=lblArtist1 runat="server" Width="125" text='<%#
DataBinder.Eval(Container, "DataItem.artist") %>'></asp:Label>
Line 74: <asp:HyperLink id=lnkEmail1 runat="server" Width="175" text='<%#
DataBinder.Eval(Container, "DataItem.email") %>' NavigateUrl='<%#
DataBinder.Eval(Container, "DataItem.email","MAILTO:{0}") %>'
Target="_blank"></asp:HyperLink>

Source File:
D:\Clients\12654\papresenters.org\papresenters.org \search.aspx Line: 72

Stack Trace:

[HttpException (0x80004005): DataBinder.Eval: 'System.Data.DataRowView'
does not contain a property with the name email.]
System.Web.UI.DataBinder.GetPropertyValue(Object container, String
propName) +146
System.Web.UI.DataBinder.Eval(Object container, String[]
expressionParts) +71
System.Web.UI.DataBinder.Eval(Object container, String expression) +82
ASP.search_aspx.__DataBind__control34(Object sender, EventArgs e) in
D:\Clients\12654\papresenters.org\papresenters.org \search.aspx:72
System.Web.UI.Control.OnDataBinding(EventArgs e) +66
System.Web.UI.Control.DataBind() +26
System.Web.UI.Control.DataBind() +86
System.Web.UI.WebControls.DataList.CreateItem(Int3 2 itemIndex,
ListItemType itemType, Boolean dataBind, Object dataItem) +127
System.Web.UI.WebControls.DataList.CreateControlHi erarchy(Boolean
useDataSource) +683
System.Web.UI.WebControls.BaseDataList.OnDataBindi ng(EventArgs e) +48
System.Web.UI.WebControls.BaseDataList.DataBind() +23
PAPresenters.search.btnSearch_Click(Object sender, EventArgs e)
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300;
ASP.NET Version:1.1.4322.2300

Can anyone help me with this? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 21 '05 #4
>
Or you could just rename the fields in the database to MEmail and AEmail

That is something I never would do. The method of ng is in my opinion the
right one.

Just my thought,

Cor
Nov 21 '05 #5
Bob
Cor:

Why not? Wouldn't it make things a little easyer to inerpret and provide
for less aliases?

Bob
Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: puzzlecracker | last post by:
Fixed font - Proportional font string initilization WHY? All 2 messages in topic - view as tree puzzlecracker Jan 29, 10:47 pm show options Newsgroups: comp.lang.c From:...
4
by: Marty Cruise | last post by:
I am getting the following error: " Object reference not set to an instance of an object." The strange thing is that I AM creating a new instance of the object in the PageLoad event Iin the code...
1
by: Jonas Auken | last post by:
hi, I have a repeater which dynamically loads another usercontrol throught databinding: OnClick: DataBind() rptProduct_ItemDataBound: ViewSmall _viewSmall = (ViewSmall)...
4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
6
by: Alan Silver | last post by:
Hello, I am data binding a repeater that has a checkbox in the ItemTemplate. The data value coming out of the database is a char(1) field containing either "y" or "n". I want to use this value...
6
by: Nathan Sokalski | last post by:
I am using a DataSet as the DataSource of a DataList in my code. The SQL used to get the data from the database begins with: SELECT...
1
by: Nathan Sokalski | last post by:
When I run my application, which uses databinding in a DataList, I recieve the following error: Server Error in '/' Application. ...
0
by: JSantora | last post by:
Essentially, InsertAT is broken! For the past couple of hours, I've been getting this "Parameter name: '-2147483550' is not a valid value for 'index'." error. Apparently, its caused by having...
0
by: =?Utf-8?B?am9uZWZlcg==?= | last post by:
I have a simple Login page that suddenly is producing this error. What is perplexing is that I didn't touch this page or anything (that I can think of that is related) All I did was make another...
2
by: Peted | last post by:
Hi, im moving a project from vs2005 to vs 2008. is doing so i have come across a compiler error regarding partial classes that i dont understand if anyone can explain it to me please the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.