Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Testing for Null values with a DataReader
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Testing for Null values with a DataReader
Miscellaneous
Thread ID:
00948865
Message ID:
00948865
Views:
54
I am getting the following error message:

"Data is Null. This method or property cannot be called on Null values."

The code causing this problem is something like this:

IDataReader dr = this.ExecReader(SelectCmd, out conn);
while (dr.Read())
{
MyString = dr.GetString(0);
}

This is processing a couple of thousand records and then errors with the message. How can I test for Null before calling GetString?

Thanks in advance for any help!

Kind Regards,

Mat
Matthew Kennedy
Decision Support Technology Inc.

"I try to take one day at a time, but sometimes several days attack me all at once." ~ Ashleigh Brilliant

New Jersey Dot Net User Group
Next
Reply
Map
View

Click here to load this message in the networking platform