.NET oledbcommand update retain values if some parameters are null
Posted on 2004-03-30
I have a question about the oledbcommand object in .NET. I am using it to update a record, however, not all of the fields of the record will need to be changed if the updating values are null. How can I retain the value in the record for those parameters that are actually null. SQL provides this by referencing the field name itself in brackets (e.g. [fieldname]). I tried this, and I tried changing the OleDbType to variant but the fields just get "[fieldname]" updated.
How do you easily retain the values of the record when some of the parameters are null, and you would rather keep the values in the table than update them with null?