query->prepare("INSERT INTO businessweek (id, source, date, headline, body) VALUES (NULL, ?, ?, ?, ?)");
query->bindValue(1, "source");
query->bindValue(2, "date");
query->bindValue(3, "headline");
query->bindValue(4, "body");
if (query->exec()) {
tt << "Query success";
} else {
qDebug() << db.lastError();
return;
}
我正在使用 QMYSQL。错误是
QSqlError(-1, "", "")
但
query->exec("INSERT INTO businessweek (id, source, date, headline, body) VALUES (NULL, 'google', 'may 0, 23', 'head', 'fjsdflksjdlkfdsjlfkjd');")
工作正常。