When adding a customer to the database, all works as expected. But when I am updating customer information, I get an error like "ERROR [07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 3." (this is not the exact error). This error popped up when I switch from an SQLite database to an Access database.

Can anybody tell what my problem might be?

Qt Code:
  1. void CustomerInfo::accept(){
  2. if(custId < 1)
  3. q.prepare("INSERT INTO customer (name, dept) VALUES(?, ?)");
  4. else
  5. q.prepare(QString("UPDATE customer SET name = ?, dept = ? WHERE custId = %1").arg(custId));
  6. q.addBindValue(ui.leName->text());
  7. q.addBindValue(ui.leDept->text());
  8. if(q.exec())
  9. setResult(QDialog::Accepted);
  10. else{
  11. setResult(QDialog::Rejected);
  12. QMessageBox::information(this, "", q.lastQuery() + "\n" + q.lastError().text());
  13. }
  14. hide();
  15. }
To copy to clipboard, switch view to plain text mode