Results 1 to 2 of 2

Thread: QSqlQuery::exec: database not open

  1. #1
    Join Date
    Mar 2018
    Qt products
    Qt4 Qt5

    Default Re: QSqlQuery::exec: database not open


    I am trying to have multiple QSqlDatabase connection.

    I had set QSqlDatabase db = QSqlDatabase::addDatabase("QPSQL","db") but QT says "QSqlQuery::exec: database not open".
    But when I make it as QSqlDatabase::addDatabase("QPSQL"), the programs works well but I unable to have multiple connection and the program will crash.

    Is there any way to do so? Thanks in advance

    Added after 40 minutes:

    Problem Solved. Did not call QSqlDatabase at setQuery.
    Last edited by ann93; 6th March 2018 at 11:37.

  2. #2
    Join Date
    Mar 2008
    Kraków, Poland
    Thanked 278 Times in 273 Posts
    Qt products
    Unix/X11 Windows

    Default Re: QSqlQuery::exec: database not open

    Show the real code.

Similar Threads

  1. Abort QSqlQuery::exec()
    By elmo in forum Qt Programming
    Replies: 5
    Last Post: 13th October 2013, 21:50
  2. [QSqlQuery] Problem with not open database
    By xkazielx in forum Newbie
    Replies: 11
    Last Post: 1st September 2013, 21:32
  3. Replies: 1
    Last Post: 18th July 2011, 13:12
  4. QSqlQuery and no response while exec()
    By jacek_ in forum Qt Programming
    Replies: 5
    Last Post: 5th November 2009, 09:47
  5. QSqlQuery::exec: database not open
    By newtowindows in forum Qt Programming
    Replies: 8
    Last Post: 29th October 2009, 09:48

Tags for this Thread


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.