日期:2014-05-20  浏览次数:20425 次

插入语句报错,各位高手过来帮帮看看
有liuyan表,id为自增字段:
  string   sql_cmd   =   "insert   into   liuyan(title,content,up_man,up_time,up_file)   values(@title,@content,@up_man,@up_time,@up_file) ";
                SqlCommand   objcmd   =   new   SqlCommand(sql_cmd,conn);
                objcmd.Parameters.Add( "@Title ",   SqlDbType.VarChar).Value   =   TextBox2.Text;
                objcmd.Parameters.Add( "@Content ",   SqlDbType.VarChar).Value   =   TextBox3.Text;
                objcmd.Parameters.Add( "@up_man ",   SqlDbType.VarChar).Value   =   TextBox1.Text;
                objcmd.Parameters.Add( "@up_time ",   SqlDbType.DateTime).Value   =   DateTime.Now.Date;
                objcmd.Parameters.Add( "@up_file ",   SqlDbType.VarChar).Value   =   "up_loadfile   string ";
                objcmd.ExecuteNonQuery();
提交提示报错:无法将   NULL   值插入列   'id ',表   'Northwind.dbo.liuyan ';该列不允许空值。INSERT   失败。但是我已经把id设为自增字段了牙,不需要在插入语句写入id了。

------解决方案--------------------
这事也会发生?