Recordset Update errors when updating sql_variant field

Posted by Stephen Nutt on Stack Overflow See other posts from Stack Overflow or by Stephen Nutt
Published on 2010-02-08T22:22:55Z Indexed on 2010/05/31 15:03 UTC
Read the original article Hit count: 170

Filed under:
|
|
|

I'm using C++ and ADO to add data to a SQL Server 2005 database. When calling the Recordset Update method for a sql_variant column I'm getting the error DB_E_ERRORSOCCURRED and the error message Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done. If the value I'm adding is NULL all works fine and all values going to the fields that are not sql_variant types work.

Does anyone know what I might be doing wrong?

Thanks

[Edit] I have some more information. The value we are storing is the empty string - ADO appears to want to store this in the sql_variant as a nchar(0), which of course is not a valid SQL data type. Is there a way to get an empty string in a sql_variant using the ADO batch commands?

© Stack Overflow or respective owner

Related posts about c++

Related posts about sql-server