System.Data.SqlClient.SqlException: 插入错误: 列名或所提供值的数目与表定义不匹配
插入错误: 列名或所提供值的数目与表定义不匹配。
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Data.SqlClient.SqlException: 插入错误: 列名或所提供值的数目与表定义不匹配。
源错误:
行 95: cmd.CommandText = strSQL.ToString();
行 96: //执行添加的SqlCommand命令
行 97: int val = cmd.ExecuteNonQuery();
行 98: //清空SqlCommand命令中的参数
行 99: cmd.Parameters.Clear();
源文件: c:\Documents and Settings\Administrator\桌面\YWcar\App_Code\Newsmanager.cs 行: 97
堆栈跟踪:
[SqlException (0x80131904): 插入错误: 列名或所提供值的数目与表定义不匹配。]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +177
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +68
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +199
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2411
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +147
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1038
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +314
System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +413
System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +115
NewsManager.AddNews(String newsTitle, String newsUser, String newsData) in c:\Documents and Settings\Administrator\桌面\YWcar\App_Code\Newsmanager.cs:97
Admin_addFile.btnOk_Click(Object sender, EventArgs e) in c:\Documents and Settings\Administrator\桌面\YWcar\Admin\addFile.aspx.cs:24
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +75
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +97
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) +4921
版本信息: Microsoft .NET Framework 版本:2.0.50727.832; ASP.NET 版本:2.0.50727.832
请师傅们给点该问题的任何带可能性的解决方法.谢谢了.
[解决办法]
sql语句有错,查查你的sql语句是否对
[解决办法]
sql语句有问题啊