我正在使用QtSql和sqlite,问题是:
QSqlQuery query;
query.prepare("SELECT * FROM [main].[items] WHERE barcode = ? OR name = ? ");
query.addBindValue(ui->Numberinput->text());
query.addBindValue(ui->search_item->text());
query.exec();
query.first();
qDebug() << query.lastError().text();
我得到“参数计数不匹配”
答案 0 :(得分:0)
QString s = QString("SELECT * FROM [main].[items] WHERE barcode = '%1' OR name = '%2'").arg(ui->Numberinput->text()).arg(ui->search_item->text());
QSqlQuery查询;