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. I cant connect my Qt to Sqlite
Qt 6.11 is out! See what's new in the release blog

I cant connect my Qt to Sqlite

Scheduled Pinned Locked Moved General and Desktop
15 Posts 5 Posters 14.5k 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.
  • L Offline
    L Offline
    leon.anavi
    wrote on last edited by
    #3

    [quote author="secretNinja" date="1304147863"]You have written on line 19: @qDebug(); << ...@ There shouldn't be ; there.[/quote]

    Yes, that ; must be causing the error.

    Btw there are really nice articles about SQLite in "Forum Nokia.":http://wiki.forum.nokia.com/index.php/CS001504_-_Creating_an_SQLite_database_in_Qt

    Regards,
    Leon

    http://anavi.org/

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #4

      so what should be there? :) thanks..

      1 Reply Last reply
      0
      • ? Offline
        ? Offline
        A Former User
        wrote on last edited by
        #5

        ok thanks..I'll try the link..:)

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #6

          Only remove ; .

          1 Reply Last reply
          0
          • L Offline
            L Offline
            leon.anavi
            wrote on last edited by
            #7

            [quote author="wenks21" date="1304148870"]so what should be there? :) thanks..[/quote]

            Just follow secretNinja's advice and remove ; because the << operator is overloaded for "qDebug":http://doc.qt.nokia.com/latest/qdebug.html

            You may also need to call text() because qDebug does not expect QSqlError:
            @
            qDebug() << db.lastError().text();
            @

            http://anavi.org/

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #8

              when i remove that line of codes. I got these errors:
              error: QSqlDatabase: No such file or directory,
              error: 'QSqlError' does not name a type,
              error: 'QSqlDatabase' does not name a type,

              I'm very sorry for being newbie.. :)

              1 Reply Last reply
              0
              • L Offline
                L Offline
                leon.anavi
                wrote on last edited by
                #9

                [quote author="wenks21" date="1304150060"]when i remove that line of codes. I got these errors:
                error: QSqlDatabase: No such file or directory,
                error: 'QSqlError' does not name a type,
                error: 'QSqlDatabase' does not name a type,

                I'm very sorry for being newbie.. :)

                [/quote]

                Make sure you have included all required headers and include the "QtSql Module ":http://doc.qt.nokia.com/latest/qtsql.html at your pro file:

                @QT += sql@

                If you are a newbie it is better to stick to some examples and tutorials :)

                Regards,
                Leon

                http://anavi.org/

                1 Reply Last reply
                0
                • ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by
                  #10

                  wow thank you very much! Now it's working.. :)

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #11

                    I still have a question. Why is that when I re-run the program the console says that 'Cannot retrieve debugging output!'

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      leon.anavi
                      wrote on last edited by
                      #12

                      [quote author="wenks21" date="1304151460"]I still have a question. Why is that when I re-run the program the console says that 'Cannot retrieve debugging output!' [/quote]

                      Please check this thread from Qt Center: "Cannot retrieve debugging output!":http://www.qtcentre.org/threads/37438-Cannot-retrieve-debugging-output!

                      Please do not use a single thread for multiple question from different issues because after that it will be difficult to track down the main issue.

                      Best regards,
                      Leon

                      http://anavi.org/

                      1 Reply Last reply
                      0
                      • ? Offline
                        ? Offline
                        A Former User
                        wrote on last edited by
                        #13

                        ok i'm sorry.. thanks again it helps a lot..:)

                        1 Reply Last reply
                        0
                        • ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by
                          #14

                          This helps me a lot. :)
                          [quote author="leon.anavi" date="1304149339"][quote author="wenks21" date="1304148870"]so what should be there? :) thanks..[/quote]

                          Just follow secretNinja's advice and remove ; because the << operator is overloaded for "qDebug":http://doc.qt.nokia.com/latest/qdebug.html

                          You may also need to call text() because qDebug does not expect QSqlError:
                          @
                          qDebug() << db.lastError().text();
                          @

                          [/quote]

                          1 Reply Last reply
                          0
                          • ? Offline
                            ? Offline
                            A Former User
                            wrote on last edited by
                            #15

                            it's solved wenks21 ?

                            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