DataSets, adapters, and Db Null's

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a dataset containing a table having some null column values
omsg += "<tr><td>Fax</td><td>" + .usrFax + "</td></tr>"
when i assign the value to a string i get a runtime error saying string to
dbnull caste problem.
what's the best way to handle this?
tyhnaks
kes
 
Thanks,
That does the job. I was hoping for a way to set a default value as a part
of the dataset.table(row)column defination, but looking at it again i can see
this would have it's own issues.
thank You!
kes
--
thanks (as always)
some day i''m gona pay this forum back for all the help i''m getting
kes


W.G. Ryan MVP said:
Check the value for IsDBNull and if it is, return a string empty
http://www.knowdotnet.com/articles/handlingnullvalues-printable.html
or some other value that you want.
 
You can use IsNull or whaatever equivalent the db you're using has, but that
presents a lot of potential problems b/c depending on how you do it, the
default value will be updated in the db when it should be null. On controls
like the datagrid, you can specify a NullText property that will show
instead of <Null> but I don't think that helps here.

Glad it's working for you though and if you have any other questions, let me
know.

Cheers,

Bill
WebBuilder451 said:
Thanks,
That does the job. I was hoping for a way to set a default value as a part
of the dataset.table(row)column defination, but looking at it again i can
see
this would have it's own issues.
thank You!
kes
 
Back
Top