|
 |
ado_dotnet thread: DataReader return values disrupted by NULL
Message #1 by "Ron Hendrickson" <ronh@s...> on Thu, 7 Feb 2002 23:40:27
|
|
I am using a DataReader object to return a single row from a database. I
then use each of the fields within this row to populate controls on
an .aspx page. (I am testing by setting the Text property of <asp:Label />
controls during Page_Load.)
If all fields return actual values within the DataReader all is fine -
text is set for all labels. However, I note that when one of the returned
fields from the database is NULL, all following fields within the returned
DataReader row are empty - and my labels contain no value.
Can anyone explain why this occurs and how I may remedy this problem. (I
don't have the option of removing all NULL values from my database.)
Message #2 by Richard Ainsley <rainsley@p...> on Thu, 07 Feb 2002 17:55:58 -0800
|
|
The DataReader returns the nulls it finds just as like it does defined
values. You can take advantage of the rule that concatenating something to
nothing is something. ie: control.text = "" &
myDataReader.Item("FieldName").value.toString ' should work just fine. Any
problem caused by not passing along defined values for fields enountered
later was probably the result of error handling interrupting the code so
that the code that assigned these defined values never ran....
Good luck
----- Original Message -----
From: "Ron Hendrickson" <ronh@s...>
To: "ADO.NET" <ado_dotnet@p...>
Sent: Thursday, February 07, 2002 3:40 PM
Subject: [ado_dotnet] DataReader return values disrupted by NULL
> I am using a DataReader object to return a single row from a database. I
> then use each of the fields within this row to populate controls on
> an .aspx page. (I am testing by setting the Text property of <asp:Label />
> controls during Page_Load.)
>
> If all fields return actual values within the DataReader all is fine -
> text is set for all labels. However, I note that when one of the returned
> fields from the database is NULL, all following fields within the returned
> DataReader row are empty - and my labels contain no value.
>
> Can anyone explain why this occurs and how I may remedy this problem. (I
> don't have the option of removing all NULL values from my database.)
$subst('Email.Unsub').
|
|
 |