System.Data.SqlClient.SqlException: 插入错误: 列名或所提供值的数目与表定义不匹配。 在 System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) 在 System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) 在 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) 在 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() 在 landing.ButtonLanding_Click(Object sender, EventArgs e) 位置 e:\Users\user\Documents\Visual Studio 2005\yhdl\landing.aspx.cs:行号 38 
   
  

解决方案 »

  1.   

    比如student表有字段id,name,sex,你插入数据时如果写
    insert into student values(@id,@name)会报上面的错误
    你可以insert into student(id,name) values(@id,@name)
      

  2.   

    列名或所提供值的数目与表定义不匹配:Sql语句写错了
      

  3.   

    string.format("insert into users values({0},{1})",user.id,user.name);
    弱国user.name 是string类型的 没加‘{1}’ 就会出现这样的错误
      

  4.   

    字段与值不符合.如
    insert into A(ID,MC) values(1,'a')
      

  5.   

    SQL语句有问题吧,仔细检查一下~~
      

  6.   

    哦 前辈的SQL 那位比较强悍呀
      

  7.   

    MSSQL自增字段ID的话,你是不需要在values中加入ID字段的,加了还会错哦
    如果确实需要,请在插入前加上一句set identity_insert 表名 on
    然后insert into 表名 (id,...) values (1,...) 
      

  8.   

    数据表的列与SQL语句里的列对不上号