解决错误:sql_variant is incompatible with xml (ASP.NET 2.0

2013 年 7 月 3 日4690

发生场景:
1:如果数据表使用XML数据类型
2:使用ASP.net 2.0
3::使用向导生成SqlDataSource配合DetailsView新增/更新数据库XML数据类型

错误信息:
Server Error in '/' Application.
--------------------------------------------------------------------------------

Operand type clash: sql_variant is incompatible with xml
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Operand type clash: sql_variant is incompatible with xml

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

解决办法:
<DeleteParameters>
<asp:Parameter Type="Int32" />
<asp:Parameter Type="String" />
<asp:Parameter Type="Int32" />
<asp:Parameter Type="String" />
<asp:Parameter Type="String" />
<asp:Parameter Type="DateTime" />
<asp:Parameter Type="Object" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Type="String" />
<asp:Parameter Type="Int32" />
<asp:Parameter Type="String" />
<asp:Parameter Type="String" />
<asp:Parameter Type="DateTime" />
<asp:Parameter Type="Object" />
<asp:Parameter Type="Int32" />
<asp:Parameter Type="String" />
<asp:Parameter Type="Int32" />
<asp:Parameter Type="String" />
<asp:Parameter Type="String" />
<asp:Parameter Type="DateTime" />
<asp:Parameter Type="Object" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Type="String" />
<asp:Parameter Type="Int32" />
<asp:Parameter Type="String" />
<asp:Parameter Type="String" />
<asp:Parameter Type="DateTime" />
<asp:Parameter Type="Object" />
</InsertParameters>
将下划线部分Type="Object" -〉Type="String"

http://http://www.zjjv.com//blogs.com/archive/2006/05/22/406577.html

版权申明:本站文章均来自网络,如有侵权,请联系028-86262244-215 ,我们收到后立即删除,谢谢!

特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有。

0 0