I'm trying to handle null values coming from a database column (which has either int or null)
I wrote this code :
int? nullInt = null;
int? typeTwo = myReader.IsDBNull(myReader["Type2"]) ? nullInt : (int)myReader["Type2"];
But I get this error :
The best overloaded method match for 'System.Data.Common.DbDataReader.IsDBNull(int)' has some invalid arguments Can you tell me how to fix this? Thanks.