You could make a function which wraps the null and put that in...
Textbox1.text = CleanThis(myreader(1))
Have you tried adding the null to an empty string?
Textbox1.text = "" & myreader(1)
or something like that
It's not clear if you are using getstring or getvalue or what
...?
Aemca said:
That was my first solution but thats way 2 much work to type that for each
value i want to use.
So this is not really a better solution for me.
Hi
Alternative is check before assigning as TextBox value.
TextBox1.Text =myRow["ColumnName"]==DBNull.Value)?"":
(string)myRow["ColumnName"]
HTH
Ravikanth
-----Original Message-----
Im looking for the best way to handle DBNULL's in
datareaders.
In a project im currently working on im using a lot of
optional data with
datareaders.
Using the following syntax im getting errors when the
field contains a
DBNULL value
Textbox1.text = myreader(1)
My current solution for this is using the isnull
function of MSSQL and
substituting null's with "" there. This means a lot of
typing for me, which
is never a good thing.
Does anyone have a better solution to my problem?
.