English 中文(简体)
将XML列更新为SQL时发生类型数据集“操作数类型冲突”错误
原标题:Typed dataset ""Operand type clash"" error updating XML column to SQL

我有一个类型化的数据集,它是我使用数据集设计器和SQL 2005数据库设计的。我使用了SQL server资源管理器,只需将表拖到设计器中即可。

表中的一列是XML字段,设计器将其设置为System.String类型。类型化数据集设计器中没有XML数据类型的选项。

我将向该数据集添加一条记录,并为XML(字符串)列分配一个XML字符串。

当我尝试使用tableAdapterManager.UpdateAll方法更新SQL时,它会产生错误:“操作数类型冲突:SQL_variant与xml不兼容”

我不知道该如何处理这件事。我在网上找不到关于这件事的任何信息,这似乎是一件非常简单和常见的事情。有什么想法吗?

最佳回答

我找到了自己问题的答案。

正在更新的表存在于同一SQL server上的另一个数据库中(数据集中有许多表,但主数据库中不存在此表)。

有人在INSERT命令中添加了“databasename.dbo.tablename”,希望它在其他数据库上更新。显然,SQL server在处理XML类型时并不喜欢这样。

我将创建一个存储过程来处理这个表上的插入。

问题回答

暂无回答




相关问题
Manually implementing high performance algorithms in .NET

As a learning experience I recently tried implementing Quicksort with 3 way partitioning in C#. Apart from needing to add an extra range check on the left/right variables before the recursive call, ...

Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How do I compare two decimals to 10 decimal places?

I m using decimal type (.net), and I want to see if two numbers are equal. But I only want to be accurate to 10 decimal places. For example take these three numbers. I want them all to be equal. 0....

Exception practices when creating a SynchronizationContext?

I m creating an STA version of the SynchronizationContext for use in Windows Workflow 4.0. I m wondering what to do about exceptions when Post-ing callbacks. The SynchronizationContext can be used ...

Show running instance in single instance application

I am building an application with C#. I managed to turn this into a single instance application by checking if the same process is already running. Process[] pname = Process.GetProcessesByName("...

How to combine DataTrigger and EventTrigger?

NOTE I have asked the related question (with an accepted answer): How to combine DataTrigger and Trigger? I think I need to combine an EventTrigger and a DataTrigger to achieve what I m after: when ...

热门标签