当前位置: 代码迷 >> ASP.NET >> INSERT INTO 语句的语法异常
  详细解决方案

INSERT INTO 语句的语法异常

热度:8544   发布时间:2013-02-25 00:00:00.0
INSERT INTO 语句的语法错误
提示INSERT   INTO   语句的语法错误
语句如下:
sql2   =   "insert   into   Student   (   Stu_ID,PassWord,Name,Sex,Department,Grade,Class   )   values   ( ' "   +   userid   +   " ', ' "   +   pwd   +   " ', ' "   +   uname   +   " ', ' "   +   sex   +   " ', ' "   +   depart   +   " ', ' "   +   grade   +   " ', ' "   +   uClass   +   " ') ";
把Class改成[Class]还是提示这样的错误~
请高手帮忙看看错在哪里~

------解决方案--------------------------------------------------------
sql2 = "insert into [Student] ( [Stu_ID],[PassWord],[Name],[Sex],[Department],[Grade],[Class] ) values ( ' " + userid + " ', ' " + pwd + " ', ' " + uname + " ', ' " + sex + " ', ' " + depart + " ', ' " + grade + " ', ' " + uClass + " ') "

这样试下
  相关解决方案