Hi
Can anyone help explain to me why I get an exception when i run the following code.
I have a datatable that has a number of columns of type int. When I add in a new row I can pass in a value of null to these rows and no exception is generated. When I proceed to iterate through the rows if I if I input a value of null I get an:
Argument Exception - Cannot set column to be null, please use DBNull instead.
If I attempt to make the columns of type int? I get a: NotSupportedException - Dataset does not support System.Nullable<>
Why do I get these exceptions, using a value of DBNull.value would not be difficult although it would mean I'd have to write more code, however I would like to understand what is actually going on here.
Thanks
Can anyone help explain to me why I get an exception when i run the following code.
I have a datatable that has a number of columns of type int. When I add in a new row I can pass in a value of null to these rows and no exception is generated. When I proceed to iterate through the rows if I if I input a value of null I get an:
Argument Exception - Cannot set column to be null, please use DBNull instead.
If I attempt to make the columns of type int? I get a: NotSupportedException - Dataset does not support System.Nullable<>
Why do I get these exceptions, using a value of DBNull.value would not be difficult although it would mean I'd have to write more code, however I would like to understand what is actually going on here.
Thanks