QSqlQuery INSERT statement with sqlite3
QSqlQuery INSERT statement with sqlite3
这个查询没有执行,我看不出我在哪里做错了
QSqlQuery query(QString("INSERT INTO [main].[sell_log] (cart_id, title, price, amount, disscount, type, total, bill_number, whos, when) "
"VALUES ('%1', '%2', '%3', '%4', '%5', '%6', '%7', '%8', '%9', '%10')").arg(cart_id).arg(title).arg(price).arg(amount).arg(disscount)
.arg(type).arg(total).arg(bill_number).arg(whos).arg(when));
qDebug() << query.lastQuery();
qDebug() << query.executedQuery();
输出:"INSERT INTO [main].[sell_log] (cart_id, title, price, amount, disscount, type, total, bill_number, whos, when) VALUES ('5', 'جديد', '7', '1', '0', 'سعر البيع', '7', '151', '1', '23-10-2016')"
""
solved:
QSqlQuery query(QString("INSERT INTO [main].[sell_log] (cart_id, title, price, amount, disscount, type, total, bill_number, whos, 'when') "
问题是"when",因为when是SQL语句,所以我需要转义
相关文章:
- Problems with std::cin.fail()
- 无法在windows上使用mingw将sqlite3与c连接
- 应用程序崩溃并显示"symbol _ZdlPvm, version Qt_5 not defined in file libQt5Core.so.5 with link time reference"
- sqlite3 和生成文件中的链接出现问题
- 这对"With a stackless coroutine, only the top-level routine may be suspended."意味着什么
- 如何在 sqlite3 中的表中添加整数列表
- Boost.TEST with CLion: "Test framework quit unexpectedly"
- 避免碎片化的ClientHellos with OpenSSL (DTLS)
- Issues with Win32 ReadProcessMemory API
- Qt with WinAPI MouseProc
- [[maybe_unused]] with structured_binding?
- Issue with WriteProcessMemory
- SQLite3 在 c++ 中输出 SELECT 上的空列表
- OpenCV RTP-Stream with FFMPEG
- "Unable to start debugging. No process is associated with this object." - 在Visual Studio Code中使用GDB
- 如何使用Qt QSqlDriver::subscribeToNotification with SQLite3?
- NPM sqlite3 with sqlcipher support
- Sqlite3 SIGSEGVs with Valgrind
- QDateTime with sqlite3
- QSqlQuery INSERT statement with sqlite3