不允许从数据类型 datetime 到数据类型 int 的隐性转换(表 'tempdb.dbo.#3884BFB0',列 'IsNominate')。请使用 CONVERT

来源:互联网 发布:javascript 关键字 编辑:程序博客网 时间:2024/06/03 20:52

 

 

不允许从数据类型 datetime 到数据类型 int 的隐性转换(表 'tempdb.dbo.#3884BFB0',列 'IsNominate')。请使用 CONVERT

函数来运行此查询。

 

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: 不允许从数据类型 datetime 到数据类型 int 的隐性转换(表 'BBS2031.dbo.pz_Forum_ReplyRecycle',列 'TableNumber')。请使用 CONVERT 函数来运行此查询。

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.

Stack Trace:

[SqlException (0x80131904): 不允许从数据类型 datetime 到数据类型 int 的隐性转换(表 'BBS2031.dbo.pz_Forum_ReplyRecycle',列 'TableNumber')。请使用 CONVERT 函数来运行此查询。]   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857434   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735046   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838   System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) +192   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +380   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135   DXBBS.DataProviders.DataProvider.ExecuteNonQuery(String CommandTxt) +59   DXBBS.DataProviders.ForumProvider.DeletePost(PostDeleteInfo pd, DataProvider dp) +3146   DXBBS.Business.Forum.DeletePost(PostDeleteInfo pd, DataProvider dp) +5   DXBBS.Controls.PostEdit.DeleteButton_Click(Object sender, EventArgs e) +906   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102


 

问题的根本原因在与字段顺序对错了  ,问题主要放生在存储过程。尤其是在存储过程中创建一临时表的时候,也就是在临时表的字段排列顺序上有问题

 

 

存储过程提示错误

 

服务器: 消息 260,级别 16,状态 1,行 7
不允许从数据类型 datetime 到数据类型 int 的隐性转换(表 'tempdb.dbo.#3884BFB0',列 'IsNominate')。请使用 CONVERT

函数来运行此查询。

 

这就是问题的根本。。。

 

 

本次问题的原因在与  在添冲临时表的是时候用到了select *  from XXX 表里面的字段与存储过程中临时表的字段顺序不匹配。。


 

 

 

 

 

 

原创粉丝点击