我有这些查询
QSqlQuery query;
query.exec("Create table users (name varchar(20), type int)");
query.exec("INSERT INTO users values('Daihee',0)");
query.exec("INSERT INTO users values('Jessica',1)");
query.exec("INSERT INTO users values('Tony',1)");
query.exec("INSERT INTO users values('Yacine',0)");
//PROJECTS
query.exec("Create table projects (name varchar(20),owner varchar(20) ,teamSize int)");
query.exec("INSERT INTO projects values('P1','Daihee', 5)");
query.exec("INSERT INTO projects values('P2','Daihee', 5)");
query.exec("INSERT INTO projects values('P3','Daihee', 5)");
query.exec("Create table projectStu (projectName varchar(30), stuName varchar(30)");
query.exec("INSERT INTO projectStu values('P1','Jessica')");
query.exec("INSERT INTO projectStu values('P2','Jessica')");
但是第三个表没有被创建,我也在使用SQLITE 任何提示都可能有所帮助!
答案 0 :(得分:1)
您在第三个表格定义的末尾错过了结束语)
。
另请查看exec()
的返回值以查看是否出现问题,并lastError()
了解它是什么。