日期:2014-05-16  浏览次数:20886 次

(C#)access插入数据的问题(自动增长)
在access中,我设置ClassId为自动增长,插入的代码为

insCmd   =   "insert   into   Class   values( "   &ClassId&   ", ' "   +   this.txtClassName.Text   +   " ', ' "   +   this.txtRemark.Text   +   " ') ";

出现错误:当前上下文中不存在ClassId

ClassId是自动增长,在代码中应该是不需要定义的呀

------解决方案--------------------
insCmd = "insert into Class(className,Remark) values( ' " + this.txtClassName.Text + " ', ' " + this.txtRemark.Text + " ') ";