I am using ADO
reader to read rows in a table with matching values in two columns. But when the reader has rows and one of the
columns in a row is null instead of a long number, I get an error when I
attempt to access the value. In C#
language, I have a statement that says "if (reader["Example"] != null) ExampleID = (long)reader["Example"];". Unfortunately, the "if" statement does not
detect the null value in the column and it attempts to store null in the "ExampleID"
long variable and an error states "Specified cast is not valid. When casting from a number, the value must be
a number less than infinity." What should
I do to prevent accessing a null value?
View Complete Post