On May 29, 3:02 pm, "axapta" <jas.jac...@gmail.comwrote:
Hi Group,
How can I overcome the issue of null values in a datareader. I keep getting
the dbnull error when I try to assign a null value to a text box.
TIA
It's actually quite easy, and requires no checks for DbNull if you
going to a string value:
//////////////
If dataReader.Read() Then
textBox1.Text = dr("MyColumnName").ToString()
End If
/////////////
The ToString() method will happily turn a DbNull into a blank string
("") when called. It's a great time saver :-)
Thanks,
Seth Rowe [MVP]