Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Sql-delete works only in Simulator

    Mobile and Embedded
    1
    2
    2535
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Matze5590 last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • M
        Matze5590 last edited by

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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post