Object null but read as empty? - PokerMan

29-Mar-07 06:20:07
I have this

object o = ds.Tables[0].Rows[i].ItemArray[j];

the item read from my dataset is null. I check on the next line :

if(o!= null)
//then do something

My prob is the object o is getting passed that if statement then i crash, in
debug it shows it with a value of {}.

So what does "{}" mean and how do i check for that?
And why does it not get set to null?

Its read from a database and the value is null there.

Thanks
button
 
 

Object null but read as empty? - Peter Bradley

29-Mar-07 06:25:27
The {} represents DbNull, I think.  If I'm right, you'll need to check for
DbNull and not for null.

Cheers


Peter
button
 

Object null but read as empty? - Ignacio Machin \( .NET/ C# MVP \)

29-Mar-07 08:58:55
Hi,

Cause a "null" ni the DB is interpreted as DBNull.Value in the code.

Check for DBNull.Value instead
button
 
How to print to the Debugger output ?