int? stockvalue = null; if (!Convert.IsDBNull(reader["StockValue"])) stockvalue = (int)reader["StockValue"]; //Then you can check if(stockValue.HasValue) { // do something here. }