我第一次在QT 5.6.0版本中为数据库模块编写代码,但在下面这一行中出现错误,我不知道如何解决该问题
代码行:
QString insertTable=QString("INSERT INTO %1(%2,%3)" "VALUES (%4,%5)".arg(tableName).arg("\'schema\'","\'timestamp\'").arg(schema,timestamp));
错误是:
C:\Users\ankit.ahlawat\Desktop\Infosys\git\IoTGateway_Database\database.cpp:212: error: request for member 'arg' in '"INSERT INTO %1(%2,%3)VALUES (%4,%5)"', which is of non-class type 'const char [36]'
"VALUES (%4,%5)".arg(tableName).arg("\'schema\'","\'timestamp\'").arg(schema,timestamp));
^
答案 0 :(得分:0)
您在调用QString("INSERT INTO %1(%2,%3)" "VALUES (%4,%5)".arg(tableName).arg("\'schema\'","\'timestamp\'").arg(schema,timestamp))
构造函数时放错了括号:
QString("INSERT INTO %1(%2,%3)" "VALUES (%4,%5)").arg(tableName).arg("\'schema\'","\'timestamp\'").arg(schema,timestamp)
应为:
{{1}}