Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

c# handle dbnull value

int? stockvalue = null;

if (!Convert.IsDBNull(reader["StockValue"]))
    stockvalue = (int)reader["StockValue"];

//Then you can check 

if(stockValue.HasValue)
{
  // do something here.
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #handle #dbnull
ADD COMMENT
Topic
Name
9+2 =