Typed dataset ""Operand type clash"" error updating XML column to SQL
I have a typed dataset which I designed using the dataset designer and a SQL 2005 DB. I used the SQL server explorer and simply dragged my tables into the designer.
One of the columns in my table is an XML field, which the designer sets as a System.String type. There is 开发者_StackOverflowno option for an XML data type in the typed dataset designer.
I am adding a record to this dataset, and assigning an XML string to the XML (string) column.
When I attempt to update SQL using the tableAdapterManager .UpdateAll method, it produces an error: “Operand type clash: sql_variant is incompatible with xml”
I have no clue how to go about dealing with this one. I can’t find anything on the web about this, and it seems like a very simple and common thing to do. Any ideas?
I found the answer for my own question.
The table that was being updated existed in a second database on the same SQL server (there are many tables in the dataset, but this one does not exist in the main database).
Somebody had added “databasename.dbo.tablename” to the INSERT command expecting it to update on the other database. Apparently, SQL server isn’t fond of this when dealing with XML types.
I am going to create a stored proc to handle the insert on this table.
精彩评论