G
Guest
Hello.
I'm changing my code which copies data from memory to a SQL Server from
using a data adapter's update method to using the writeToServer method of the
SQLBulkCopy object.
The update method of the data adapter worked fine, but I expect the
SQLBulkCopy to perform better.
The problem is I'm getting an error message that one of the fields doesn't
allow null values.
With the data adapter, I didn't explicitly have to set the fields to
anything, as the fields have a default value of zero defined on the server.
I'm using the SQLBulkCopyOption KeepIdentity and even tried using (Not
SqlBulkCopyOptions.KeepNulls), but still get the error.
Does SQLBulkCopy not recognize default values unless the field value is
explicitly set to null? That's the next thing I'm going to try, and if it
doesn't work, I'm going back to using the data adapter.
Thanks for any information you can provide.
I'm changing my code which copies data from memory to a SQL Server from
using a data adapter's update method to using the writeToServer method of the
SQLBulkCopy object.
The update method of the data adapter worked fine, but I expect the
SQLBulkCopy to perform better.
The problem is I'm getting an error message that one of the fields doesn't
allow null values.
With the data adapter, I didn't explicitly have to set the fields to
anything, as the fields have a default value of zero defined on the server.
I'm using the SQLBulkCopyOption KeepIdentity and even tried using (Not
SqlBulkCopyOptions.KeepNulls), but still get the error.
Does SQLBulkCopy not recognize default values unless the field value is
explicitly set to null? That's the next thing I'm going to try, and if it
doesn't work, I'm going back to using the data adapter.
Thanks for any information you can provide.