Link to home
Start Free TrialLog in
Avatar of boricua1213
boricua1213

asked on

Strongly typed dataset Null Values Causes Exception

I got a table that has columns that are int type that allow for nulls.  I used VS2005 dataset designer to create strongly typed dataset.  When I retrieve rows that have null values in those columns an exception is thrown.

Has anybody got a workaround to this.  I was thinking of changing type to string since in VS that is the only type I can set it not to throw exception then in my BLL convert it to nullable(of Integer).

Any ideas would certainly help.

Thank you

Rick
Avatar of Jens Fiederer
Jens Fiederer
Flag of United States of America image

Have you tried typing the columns as Nullables?
Avatar of boricua1213
boricua1213

ASKER

Well,

in the properties of the column in the dataset AllowDBNull is set to True.

And in SQL the column is nullable.

What exactly do u mean by "typing the columns as Nullables"?

Rick
ASKER CERTIFIED SOLUTION
Avatar of Jens Fiederer
Jens Fiederer
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
With 2005, you just have to keep using IsNull before referencing the column.
SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial