Basic Questions about Datareaders

liunx

Guest
Hi Guys!

first if all i wanna thank all of you for helping me during all this time.
Just having a little issue again.


While sdr.Read
If Not sdr.IsDBNull(1) Then
bphone = sdr.Item("BPhone")
End If
end while


I can use the "columnname" in sdr.item("columnname")
but in sdr.isdbnull(i) there is not possibility to use the columnname?

I would like to check if the value is null, if so i do nothing, is not so i fill up my variable.
my variable is declared as a "string" so if it would be null i get an error.

I would really like to use columnnames, or is there another way to get around this?found my solution
again, sorry to bug you with this..


If Not sdr.Item("bPhone") Is System.DBNull.Value Then
txttitle.Text = sdr.Item("bphone")
End Ifhow bound .ToString(); on the end would make nulls ""Thx man! that saves me 2 extra lines of code!
I got like a few thousand lines of code so it's really usefull to do it!you might want to look into code smith.
 
Back
Top