这是我的代码,我需要添加更多的行,我只用了两行就进行了测试
' insert into db
mySQL="INSERT INTO scheduleparts (scheduleid, locationid, dayid, partid, stime, guys, position) VALUES (" & pschedid & ", " & pidlocation & ",1,1,'" &ps11& "', " & pg11 & ", " & pp11 & "),(" & pschedid & ", " & pidlocation & ",1,2,'" &ps12& "', " & pg12 & ", " & pp12 & ")"
call updateDatabase(mySQL, rstemp, "addscheduleform4.asp")
我一直收到“在SQL语句末尾缺少分号(;)”的错误信息。我添加了分号,结果得到"expected of statement“
下面我将发布我尝试使用分号的所有方法。我不知道还能做什么。
' insert into db
mySQL="INSERT INTO scheduleparts (scheduleid, locationid, dayid, partid, stime, guys, position) VALUES (" & pschedid & ", " & pidlocation & ",1,1,'" &ps11& "', " & pg11 & ", " & pp11 & "),(" & pschedid & ", " & pidlocation & ",1,2,'" &ps12& "', " & pg12 & ", " & pp12 & ");"
call updateDatabase(mySQL, rstemp, "addscheduleform4.asp")
' insert into db
mySQL="INSERT INTO scheduleparts (scheduleid, locationid, dayid, partid, stime, guys, position) VALUES (" & pschedid & ", " & pidlocation & ",1,1,'" &ps11& "', " & pg11 & ", " & pp11 & "),(" & pschedid & ", " & pidlocation & ",1,2,'" &ps12& "', " & pg12 & ", " & pp12 & ")";
call updateDatabase(mySQL, rstemp, "addscheduleform4.asp")
' insert into db
mySQL="INSERT INTO scheduleparts (scheduleid, locationid, dayid, partid, stime, guys, position) VALUES (" & pschedid & ", " & pidlocation & ",1,1,'" &ps11& "', " & pg11 & ", " & pp11 & "),(" & pschedid & ", " & pidlocation & ",1,2,'" &ps12& "', " & pg12 & ", " & pp12 & ";)"
call updateDatabase(mySQL, rstemp, "addscheduleform4.asp")
' insert into db
mySQL="INSERT INTO scheduleparts (scheduleid, locationid, dayid, partid, stime, guys, position) VALUES (" & pschedid & ", " & pidlocation & ",1,1,'" &ps11& "', " & pg11 & ", " & pp11 & "),(" & pschedid & ", " & pidlocation & ",1,2,'" &ps12& "', " & pg12 & ", " & pp12 & ")"
call updateDatabase(mySQL, rstemp, "addscheduleform4.asp");
' insert into db
mySQL="INSERT INTO scheduleparts (scheduleid, locationid, dayid, partid, stime, guys, position) VALUES (" & pschedid & ", " & pidlocation & ",1,1,'" &ps11& "', " & pg11 & ", " & pp11 & "),(" & pschedid & ", " & pidlocation & ",1,2,'" &ps12& "', " & pg12 & ", " & pp12 & ")";"
call updateDatabase(mySQL, rstemp, "addscheduleform4.asp")
' insert into db
mySQL="INSERT INTO scheduleparts (scheduleid, locationid, dayid, partid, stime, guys, position) VALUES (" & pschedid & ", " & pidlocation & ",1,1,'" &ps11& "', " & pg11 & ", " & pp11 & "),(" & pschedid & ", " & pidlocation & ",1,2,'" &ps12& "', " & pg12 & ", " & pp12 & ");";
call updateDatabase(mySQL, rstemp, "addscheduleform4.asp")
和我受挫的审判:
' insert into db
mySQL="INSERT INTO scheduleparts (scheduleid, locationid, dayid, partid, stime, guys, position) VALUES (" & pschedid & ", " & pidlocation & ",1,1,'" &ps11& "', " & pg11 & ", " & pp11 & "),(" & pschedid & ", " & pidlocation & ",1,2,'" &ps12& "', " & pg12 & ", " & pp12 & ")";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
call updateDatabase(mySQL, rstemp, "addscheduleform4.asp")
每种方法每次都会失败。我要么缺少分号,要么语句结束
发布于 2015-03-20 08:27:01
当插入到MYSQL中时,需要用单引号将要插入的值括起来。尝试在用双引号括起变量名前后添加它们,例如
('" & pschedid & "',
如果单引号不起作用,试着用反引号。MYSQL对它的引号有点奇怪,如果你用单引号在Word中输入查询,然后复制粘贴,它不会起作用,但如果你在记事本上做,它就会起作用。
https://stackoverflow.com/questions/27833100
复制相似问题