Skip to content Skip to sidebar Skip to footer

C# Sql Data Adapter System.data.strongtypingexception

I get my data from SQL to Dataset with Fill. It's just one table with two columns (CategoryId (int) and CategoryName (varchar)). When I look at my dataset after fill method, Catego

Solution 1:

When you get the value of a row/column in a typed dataset, by default it raises this exception when the value is DBNull. So

string x = Row.CategoryName;//Raises this exception when CategoryName is null.

You can correct this with the typed dataset designer. Set the property "Nullvalue" of the CategroyName column to "(Empty)"

Post a Comment for "C# Sql Data Adapter System.data.strongtypingexception"