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. SQLite database creation
Forum Update on Monday, May 27th 2025

SQLite database creation

Scheduled Pinned Locked Moved Solved General and Desktop
sqllitemysqldatabaseqsqlite
6 Posts 5 Posters 1.1k Views
  • 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.
  • G Offline
    G Offline
    Giggon
    wrote on 30 May 2020, 17:00 last edited by
    #1

    Hello, I can't create a database variable and assign it to a file on my hard drive. On my C: drive I have a file "spanie1.db"
    Here is the code:MicrosoftTeams-image (1).png

    It seems to work correctly, the object "label" has it's text set to "Connected..."

    However, any SQL query i want to implement doesn't work. Here is what I found out:
    if I change line #2 and modify the path to "spanie1.db" to any other, or change file name for example:
    mydb.setDatabaseName("C:/spanieeee1.db");

    the "label" text is also being set to "Connected..."

    There is no such file as spanieeee1.db on my C drive, yet the program acts as if there indeed is.

    Any solutions?

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AliM93
      wrote on 30 May 2020, 18:19 last edited by
      #2

      hi! Is the path of your db set properly?

      1 Reply Last reply
      1
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 30 May 2020, 18:40 last edited by
        #3

        Hi and welcome to devnet,

        What queries are failing ?
        What error do you get ?
        Does that database already contain data ?

        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
        2
        • C Offline
          C Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 30 May 2020, 19:34 last edited by
          #4

          Additonal: do you really have write access to your root dir?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          G 1 Reply Last reply 30 May 2020, 21:31
          3
          • C Christian Ehrlicher
            30 May 2020, 19:34

            Additonal: do you really have write access to your root dir?

            G Offline
            G Offline
            Giggon
            wrote on 30 May 2020, 21:31 last edited by
            #5

            @Christian-Ehrlicher said in SQLite database creation:

            Additonal: do you really have write access to your root dir?

            Turns out I didn't. I changed the file location to D drive and it worked like magic. Thanks a lot!

            Thread to be closed

            P 1 Reply Last reply 30 May 2020, 23:04
            0
            • G Giggon
              30 May 2020, 21:31

              @Christian-Ehrlicher said in SQLite database creation:

              Additonal: do you really have write access to your root dir?

              Turns out I didn't. I changed the file location to D drive and it worked like magic. Thanks a lot!

              Thread to be closed

              P Offline
              P Offline
              Pablo J. Rogina
              wrote on 30 May 2020, 23:04 last edited by
              #6

              @Giggon said in SQLite database creation:

              Thread to be closed

              Please go and mark the post as solved. Thanks

              Upvote the answer(s) that helped you solve the issue
              Use "Topic Tools" button to mark your post as Solved
              Add screenshots via postimage.org
              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

              1 Reply Last reply
              0

              6/6

              30 May 2020, 23:04

              • Login

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