Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Problems with pointers between QSqlQuerry and QSqlDatabase
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Problems with pointers between QSqlQuerry and QSqlDatabase

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 950 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    arsinte_andrei
    wrote on last edited by
    #1

    i have a smole piece of code that create me a lot f trouble.. and I do nt understand why.. if any of yoou can explayn that will be greatfull..
    @
    //to create QSqlDatabase i have
    QSqlDatabase *myDb = new QSqlDatabase();
    .......// and all orther stuff for connection - is ok is working is open.

    //to create a querry now
    QSqlQuery *myQuery = new QSqlQuery(myDb);
    //my sql query and querry exec...
    @

    but there is giving me this error

    in the static member function 'static QSqlQuery* myClassName::myFunctionName(); no matching function for call to QSqlQuery::QSqlQuery(QSqlDatabase*)

    1 Reply Last reply
    0
    • A Offline
      A Offline
      arsinte_andrei
      wrote on last edited by
      #2

      ok.. I've solved myself is just a simple pointer mistake.. so.. from..
      @QSqlQuery *myQuery = new QSqlQuery(myDb);@
      become
      @QSqlQuery *myQuery = new QSqlQuery(*myDb);@
      and everithing is fine now..
      just do not forget *--

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Please have a look at "QSqlDatabase's documentation":http://qt-project.org/doc/qt-5/qsqldatabase.html#details to see the proper use of that class

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved