|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to manage DBNullI use the new feature of TableAdapter in VS2005.
There is a DataSet name dsSt, I want to fetch the value of a field in a datarow. I use the code: foreach (dsSt.StRow rowSt in dtSt.Rows) { int iNum=rowSt.Num ... But when rows.Num is a DBNull, it cause an Exception. How can I determinate if rowSt.Num is a DBNull before I assigned it to a variable? ad wrote:
Show quote > I use the new feature of TableAdapter in VS2005. There should be rowSt.IsNumNull() method generated paired with rowSt.SetNumNull().> There is a DataSet name dsSt, I want to fetch the value of a field in a > datarow. > I use the code: > > foreach (dsSt.StRow rowSt in dtSt.Rows) > { > int iNum=rowSt.Num > ... > > But when rows.Num is a DBNull, it cause an Exception. > > How can I determinate if rowSt.Num is a DBNull before I assigned it to a > variable? |
|||||||||||||||||||||||