Results 1 to 12 of 12

Thread: QSQLITE logic error

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Posts
    58
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X

    Default QSQLITE logic error

    Hi,

    I have a QSQLITE database and I want to insert some stuff, I'm using a prepare query and finally a exec function. But I get the message:
    SQL Logic error or missing database, unable to fetch rows
    This is the code:
    Qt Code:
    1. this->connect();
    2.  
    3. if(this->isConnected){
    4. QSqlQuery query;
    5.  
    6. query.prepare("INSERT INTO clients (`cid`, `firstName`, `lastName`, `address`, `zipCode`, `city`, `phoneNr`, `email`) "
    7. " VALUES( '', :firstName, :lastName, :address, :zipCode, :city, :phoneNr, :email)");
    8. query.bindValue(":firstName", strFirstName);
    9. query.bindValue(":lastName", strLastName);
    10. query.bindValue(":address", strAddress);
    11. query.bindValue(":zipCode", strZipCode);
    12. query.bindValue(":city", strCity);
    13. query.bindValue(":phoneNr", strPhoneNr);
    14. query.bindValue(":email", strEmail);
    15.  
    16. if(query.exec()){
    17. emit databaseChanged();
    18. return true;
    19. }else{
    20. QSqlError error = query.lastError();
    21. QString sError = error.text();
    22. QMessageBox::critical(this, tr("SQL error"), sError);
    23. return false;
    24. }
    25. this->closeConnection();
    26. }
    To copy to clipboard, switch view to plain text mode 

    Does somebody know how to solve this?

    Thx,

    Cyberboy
    Last edited by jacek; 8th February 2008 at 13:59. Reason: wrapped too long line

Similar Threads

  1. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 12:57
  2. Error compiling psql plugin
    By vieraci in forum Installation and Deployment
    Replies: 4
    Last Post: 7th October 2007, 02:49
  3. qt 4.2.2 install on aix
    By try to remember in forum Installation and Deployment
    Replies: 2
    Last Post: 28th March 2007, 12:19
  4. Qt-x11-commercial-src-4.2.0-snapshot-20060824 error
    By DevObject in forum Installation and Deployment
    Replies: 4
    Last Post: 24th August 2006, 23:31
  5. use qpsql
    By raphaelf in forum Installation and Deployment
    Replies: 34
    Last Post: 22nd August 2006, 12:52

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.