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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top