错误:System.Data.SqlClient.SqlException(0x80131904):转换nvarchar值时转换失败

时间:2015-04-01 13:08:43

标签: c# html

  

错误:System.Data.SqlClient.SqlException(0x80131904):将nvarchar值'ff'转换为数据类型int时转换失败。在System.Data.SqlClient.SqlConnection.OnError(SqlException异常,Boolean breakConnection,Action 1 wrapCloseInAction) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action 1 wrapCloseInAction)处于System.Data.SystemClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,Boolean callerHasConnectionLock,Boolean asyncClose) System.Data上的System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds,RunBehavior runBehavior,String resetOptionsString)中的.SqlClient.TdsParser.TryRun(RunBehavior runBehavior,SqlCommand cmdHandler,SqlDataReader dataStream,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj,Boolean& dataReady) System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,String)中的.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior,RunBehavior runBehavior,Boolean returnStream,Boolean async,Int32 timeout,Task& task,Boolean asyncWrite)方法,TaskCompletionSource 1 completion, Int32 timeout, Task& task, Boolean asyncWrite) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource 1完成,字符串我thodName,Boolean sendToPipe,Int32 timeout,Boolean asyncWrite)位于C:\ myProjectFiles \ MyApp \ MyApp \ Registration.aspx中MyApp.WebForm1.Button1_Click(Object sender,EventArgs e)的System.Data.SqlClient.SqlCommand.ExecuteNonQuery()。 cs:第48行ClientConnectionId:a7f5710d-3f9e-4cd9-bf01-49ad3fd8cec4

1 个答案:

答案 0 :(得分:0)

Conversion failed when converting the nvarchar value 'ff' to data type int.

您的错误所说的错误,您的SQL查询转换失败。很难说你的查询中的问题在哪里,而没有看到查询。