Results 1 to 14 of 14

Thread: QSqlQuery not working

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Jun 2010
    Location
    Salatiga, Indonesia
    Posts
    160
    Thanks
    11
    Thanked 32 Times in 29 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    1

    Default Re: QSqlQuery not working

    If you modify your codes to the following:
    Qt Code:
    1. int ProductsForm::categoryIdByName(const QString& name)
    2. {
    3. QSqlQuery categories(model->database());
    4. categories.exec(QString("SELECT id FROM Categories WHERE name='%1'").arg(name));
    5. if(categories.size()==-1)
    6. {
    7. qDebug() << "error";
    8. return 1;
    9. }
    10. .....
    11. }
    To copy to clipboard, switch view to plain text mode 

    is categories.size() value still -1 ?

  2. The following user says thank you to saa7_go for this useful post:

    BrainStorm (15th August 2010)

Similar Threads

  1. QSqlQuery
    By yasher in forum Qt Programming
    Replies: 2
    Last Post: 23rd July 2010, 14:25
  2. QSqlquery
    By codeman in forum Qt Programming
    Replies: 10
    Last Post: 4th June 2009, 12:57
  3. what is going on a QSqlQuery?
    By mismael85 in forum Qt Programming
    Replies: 2
    Last Post: 26th June 2008, 13:35
  4. QSqlQuery problem
    By MarkoSan in forum Qt Programming
    Replies: 14
    Last Post: 14th January 2008, 22:50
  5. QSqlQuery error
    By skuda in forum Qt Programming
    Replies: 2
    Last Post: 2nd November 2007, 08:43

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.