[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INSERT INTO result(studentNo,subjectNo,examDate,studentResult)
VALUES (10002,1,' at line 3
解决办法为:原来是里面
/*--关闭事务自动提交--*/
SET autocommit = 0;
/*--开启新事务--*/
START TRANSACTION;
/*--插入数据--*/
INSERT INTO result(StudentNo,SubjectNo,ExamDate,StudentResult)
VALUES(10001,1,NOW(),90)
INSERT INTO result(StudentNo,SubjectNo,ExamDate,StudentResult)
VALUES(10002,1,NOW(),70);
INSERT INTO Result(StudentNo,SubjectNo,ExamDate,StudentResult)
VALUES(10003,1,NOW(),67);
/*--提交事务--*/
COMMIT;
/*--插入错误数据--*/
INSERT INTO Result(StudentNo,SubjectNo,ExamDate,StudentResult)
VALUES(10004,1,NOW(),101);
INSERT INTO Result(StudentNo,SubjectNo,ExamDate,StudentResult)
VALUES(10005,1,NOW(),102);
/*--回滚事务--*/
ROLLBACK;
/*--开启自动提交--*/
SET autocommit = 1;
有的行数没有加分号造成的。
加分号后运行成功!还是