"Filipe Cristóvão" <fi**************@lizserve.nospam.pt> wrote in message news:eS**************@TK2MSFTNGP12.phx.gbl...
Hi,
I know that this is a newbie's question, but I need to know how i do to know
if a field in a table is DBNull.
If I try to write (with response.write) the field, it gives me an error:
"Cast from type 'DBNull' to type 'String' is not valid".
Thanks for any help.
--
Filipe Cristóvão
Various options:
* You can test against DBNull.Value (if (myDataRow["field"] == DBNull.Value) ... )
* DataRow has an IsNull(..) method to check a specific column in that row
* Don't cast to string, but use the ToString() method, DBNull gives an empty string
Hans Kesting