Qt中的数据库创建错误

amr*_*neo 2 c++ database qt qt4

我正在使用此代码来创建数据库.但我在调试中得到"假".我尝试了很多,但它不起作用.这有什么错误?

 QSqlQuery query;
qDebug() << query.exec("CREATE TABLE glucose (id INTEGER PRIMARY KEY AUTOINCREMENT, value INTEGER, date TEXT, time TEXT, duration TEXT, note TEXT");

   qDebug() << query.prepare("INSERT INTO glucose(id, value, date, time, duration, note)""VALUES(?, ?, ?, ?, ?, ?)");

   query.bindValue(1,edit_glucose->text().toInt());

   query.bindValue(2,datetime->date());

  query.bindValue(3,datetime->time());

  query.bindValue(4,"a");

   query.bindValue(5,edit_note->toPlainText());
   qDebug() << query.exec();
Run Code Online (Sandbox Code Playgroud)

Hai*_*vgi 5

你忘了关闭你的 CREATE TABLE查询 ")"