problem with null column
Posted
by Iulian
on Stack Overflow
See other posts from Stack Overflow
or by Iulian
Published on 2010-05-19T11:52:43Z
Indexed on
2010/05/19
12:00 UTC
Read the original article
Hit count: 337
c#
|strongly-typed-dataset
One column in my database (of type double) has some null values. I am executing a sored procedure to get the data in my app
wipDBTableAdapters.XLSFacturiTableAdapter TAFacturi = new wipDBTableAdapters.XLSFacturiTableAdapter();
var dtfacturi = TAFacturi.GetData(CodProiect);
Then i try to do something like this:
if (dtfacturi[i].CANTITATE == null)
{
//do something
}
this is giving a warning :
The result of the expression is always 'false' since a value of type 'double' is never equal to 'null' of type 'double?
However when i run my code i get the following exception:
StrongTypingException
The value for column 'CANTITATE' in table 'XLSFacturi' is DBNull.
How am I supposed to resolve this ?
© Stack Overflow or respective owner