Results 1 to 12 of 12

Thread: [QSqlQuery] Problem with not open database

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: [QSqlQuery] Problem with not open database

    From the docs:
    Warning: You must load the SQL driver and open the connection before a QSqlQuery is created.
    Works fine when the query is created in your "registrar_BD" method. You'll have to handle error messaging some other way if you do that though.

    HTH
    Last edited by norobro; 23rd July 2010 at 03:40.

  2. #2
    Join Date
    Jul 2010
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: [QSqlQuery] Problem with not open database

    i has solved that problem...thanks for your reply norobro.

  3. #3
    Join Date
    May 2013
    Location
    Schweiz
    Posts
    21
    Thanked 1 Time in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: [QSqlQuery] Problem with not open database

    Quote Originally Posted by spiderman3000p View Post
    i has solved that problem...thanks for your reply norobro.
    great, if you share your solution you might help others.
    thanks.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: [QSqlQuery] Problem with not open database

    You woke up a three year old thread to add that?

    Accessing databases has been done repeatedly in this forum and there are plenty of examples in the docs. If you have a specific question of your own then feel free to open a new thread, show what you have done, explain what you expected, what you got, what you have done to try to resolve the problem etc.

    Spiderman3000p simply had to follow norobro's hint that the routine works if the query object is created in the routine that tries to use it. Actually, it just needs to be created after the database is added.

  5. #5
    Join Date
    May 2013
    Location
    Schweiz
    Posts
    21
    Thanked 1 Time in 1 Post
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: [QSqlQuery] Problem with not open database

    Quote Originally Posted by ChrisW67 View Post
    You woke up a three year old thread to add that?
    Hi Chris,
    sorry for that, I saw the date of the post after I hit the reply button. Another lesson learned. I will be careful next time.

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.