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 withdatareaders.
Using the following syntax im getting errors when the field contains aDBNULL value
Textbox1.text = myreader(1)
My current solution for this is using the isnull function of MSSQL andsubstituting null's with "" there. This means a lot of typing for me, whichis never a good thing.
Does anyone have a better solution to my problem?
.