开发者

Recordset Update errors when updating sql_variant field

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 er开发者_StackOverflowror 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?


You are only being shown the outer-most error there and as the error suggest you need to check the inner errors to find out the problem.

Apologies, I'm a VB developer but if you loop through the errors on your connection object you should be able to pinpoint the actual error.

From my classic ADO days multiple-step errors usually pointed at trying to stuff something to big into your column, e.g a string thats too big or a number with too high precision.

Hope this helps.

Ed

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜