Important: Please read the Qt Code of Conduct -

Sql-delete works only in Simulator

  • Hello,

    i have a sqlite database in my project. alle the data in the database is shown in a QTableView.
    When i select a row and press a "delete"-Button this row should be deleted.
    everything works fine with Simulator, but on device(Nokia N8) nothing happens.
    Any idea why?

    Here my code:
    @QTextStream(&str_del) << "DELETE FROM Table WHERE ID = " << index.row() << ";";
    if (query_ges.exec(str_del) == false){
    QSqlError err = query_ges.lastError();
    if (err.number() != 1){
    QMessageBox::warning(this, "Error", err.text(), "Ok");
    When i debug the Statement looks like that:
    "DELETE FROM Table WHERE ID = 1;"
    and no error occures.

  • i dont know why, but when i set the ID as "NOT NULL PRIMARY KEY" everything works fine, also on device!

Log in to reply