首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

用户代码未处理 System.Data.SqlClient.SqlException 的有关问题,求教育?

2012-12-25 
用户代码未处理 System.Data.SqlClient.SqlException 的问题,求教育??急急用户代码未处理 System.Data.Sql

用户代码未处理 System.Data.SqlClient.SqlException 的问题,求教育??急急
用户代码未处理 System.Data.SqlClient.SqlException
  Message=插入错误: 列名或所提供值的数目与表定义不匹配。
  Source=.Net SqlClient Data Provider
  ErrorCode=-2146232060
  Class=16
  LineNumber=1
  Number=213
  Procedure=""
  Server=.
  State=1
  StackTrace:
       在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
       在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
       在 System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       在 System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
       在 System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
       在 System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
       在 manages_addNew.BttTijiao_Click(Object sender, EventArgs e) 位置 i:\ProJ\manages\addNew.aspx.cs:行号 22
       在 System.Web.UI.WebControls.Button.OnClick(EventArgs e)
       在 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
       在 System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
       在 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       在 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
       在 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException: 

[最优解释]
检查一下你的Insert语句吧,根据错误信息来判断是那里出了错误
[其他解释]
SQL语句有问题,你把语句放进数据库执行一下,你就知道了,
[其他解释]
这个错误的意思是这样的,举例如下:
数据库表A有两个字段a,b ,程序员却尝试
insert into A values (a,b,c) 
就是你要insert的表提供的字段必须和数据库表的列相匹配
[其他解释]
我的数据库表是一个New表 ,字段有NEWID,author,tile,readcount,addtime,contents,6个字段,我在添加新闻时只设置author,tile,addtime,contents,三个字段,其他的不用添加也行吧 

[其他解释]

引用:
我的数据库表是一个New表 ,字段有NEWID,author,tile,readcount,addtime,contents,6个字段,我在添加新闻时只设置author,tile,addtime,contents,三个字段,其他的不用添加也行吧
各位请指教了!!
[其他解释]
添加新闻的界面

[其他解释]


引用:
用户代码未处理 System.Data.SqlClient.SqlException
  Message=插入错误: 列名或所提供值的数目与表定义不匹配。
  Source=.Net SqlClient Data Provider
  ErrorCode=-2146232060
  Class=16
  LineNumber=1
  Number=213
  Procedure=""……

热点排行