Results 1 to 3 of 3

Thread: QSqlDatabase::lastError() in MessageBox

  1. #1
    Join Date
    Oct 2012
    Posts
    13
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default QSqlDatabase::lastError() in MessageBox

    I'm trying to figure out why my connection is failing, yet I can't show the last error in a mesagebox. This is a GUI application and using qDebug() << db.lastError() does not display anything. When I do put db.lastError() in the messagebox text, I get this error: error: no matching function for call to 'QMessageBox::setText(QSqlError)'

    How can I show the last error? I haven't found any viable method of converting QSqlError to QString.

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QSqlDatabase::lastError() in MessageBox


  3. #3
    Join Date
    Oct 2012
    Posts
    13
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QSqlDatabase::lastError() in MessageBox

    Well that's embarrassing! Thanks Lesiok. "Driver not found".

Similar Threads

  1. Replies: 0
    Last Post: 2nd December 2011, 19:52
  2. Getting the Icon of a MessageBox
    By thru in forum Qt Programming
    Replies: 2
    Last Post: 29th December 2010, 17:19
  3. Extending MessageBox
    By thru in forum Qt Programming
    Replies: 7
    Last Post: 17th December 2010, 16:31
  4. Qt 4.5.1 / MySQL 5.1, QSqlQuery::lastError() 1295
    By wdezell in forum Qt Programming
    Replies: 1
    Last Post: 21st July 2009, 15:36
  5. QSA 1.2.1 && MessageBox
    By xk in forum Newbie
    Replies: 0
    Last Post: 20th April 2006, 17:30

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.