Handle DBNull in C#

Posted by Andreas on Stack Overflow See other posts from Stack Overflow or by Andreas
Published on 2010-03-12T13:56:25Z Indexed on 2010/03/12 13:57 UTC
Read the original article Hit count: 338

Filed under:
|
|
|

Is there a better/cleaner way to do this?

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

© Stack Overflow or respective owner

Related posts about convert

Related posts about dbnull