4
Answers

Error message: "Data is null.This method or property cannot be called on Null Values."

Dealy

Dealy

15y
15.3k
1
Hello,

I have the following code:
String name;
 
if (rdr.GetString(rdr.GetOrdinal("NAME")) == null)
    name = "";
 else
    name = rdr.GetString(rdr.GetOrdinal("NAME"));

                           

and i'm getting an error message "Data is null.This method or property cannot be called on Null Values."

Any ideas why i'm getting this error message?

Thank you in advance.
Answers (4)