Tuesday 7 January 2014

C# - How to fix error The name 'DbNull' does not exist in the current context


Replace
 if (row["ID"] != DbNull.value)
  {
                    myID = (int)row["ID"];
  }

with
  if (row["ID"] != null)
  {
                    myID = (int)row["ID"];
  }


No comments:

Post a Comment