首页 > 编程 > .NET > 正文

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

2024-07-10 13:10:40
字体:
来源:转载
供稿:网友

发生场景:
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 name="original_articleid" type="int32" />
                <asp:parameter name="original_title" type="string" />
                <asp:parameter name="original_categoryid" type="int32" />
                <asp:parameter name="original_contents" type="string" />
                <asp:parameter name="original_articlefrom" type="string" />
                <asp:parameter name="original_createdate" type="datetime" />
                <asp:parameter name="original_keywordxml" type="object" />
            </deleteparameters>
            <updateparameters>
                <asp:parameter name="title" type="string" />
                <asp:parameter name="categoryid" type="int32" />
                <asp:parameter name="contents" type="string" />
                <asp:parameter name="articlefrom" type="string" />
                <asp:parameter name="createdate" type="datetime" />
                <asp:parameter name="keywordxml" type="object" />
                <asp:parameter name="original_articleid" type="int32" />
                <asp:parameter name="original_title" type="string" />
                <asp:parameter name="original_categoryid" type="int32" />
                <asp:parameter name="original_contents" type="string" />
                <asp:parameter name="original_articlefrom" type="string" />
                <asp:parameter name="original_createdate" type="datetime" />
                <asp:parameter name="original_keywordxml" type="object" />
            </updateparameters>
            <insertparameters>
                <asp:parameter name="title" type="string" />
                <asp:parameter name="categoryid" type="int32" />
                <asp:parameter name="contents" type="string" />
                <asp:parameter name="articlefrom" type="string" />
                <asp:parameter name="createdate" type="datetime" />
                <asp:parameter name="keywordxml" type="object" />
            </insertparameters>
将下划线部分type="object"  -〉type="string"

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表