Results 1 to 5 of 5

Thread: model->select() gives error "you have an error in your syntax" etc.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2007
    Location
    Groningen Netherlands
    Posts
    182
    Thanks
    16
    Thanked 2 Times in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default model->select() gives error "you have an error in your syntax" etc.

    Hello,

    Don't know what happens here, it's just a plain litte table.
    The error msg is: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'index, ip, name, pass FROM members' at line 1 QMYSQL: Unable to execute query"
    It's the only table that produces this error.
    QSqlQuery on it works and shows the content.

    Qt Code:
    1. db = QSqlDatabase::addDatabase("QMYSQL");
    2. db.setHostName("192.168.1.10");
    3. db.setDatabaseName("iris");
    4. db.setUserName("me");
    5. db.setPassword("pass");
    6. if (!db.open())
    7. setWindowTitle(db.lastError().text());
    8. model = new QSqlTableModel;
    9. model->setTable("members");
    10. if (!model->select())
    11. qDebug() << model->lastError().text();
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 15th February 2008 at 10:58. Reason: missing closing quote

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.