Null insert problem

  • Thread starter Thread starter aculfa
  • Start date Start date
A

aculfa

Hi everyone,

We can not set an integer value as null, since it's a value type.

We want to insert this integer value to a DataTable which has an integer
column. (And then update the database..)

How can we achieve to write null to the dataTable or at least to database?

Thanks,
 
aculfa,

You should be able to set the column value for the row to the static
Value property on the DbNull class. This should make it null. Either that,
or create a new instance of the SqlInt32 structure and set the IsNull
property to true.

Hope this helps.
 
Back
Top