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

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 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 last edited by
      #2

      hi! Is the path of your db set properly?

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on 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
        • Christian EhrlicherC Online
          Christian EhrlicherC Online
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on 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
          3
          • Christian EhrlicherC Christian Ehrlicher

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

            G Offline
            G Offline
            Giggon
            wrote on 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

            Pablo J. RoginaP 1 Reply Last reply
            0
            • G Giggon

              @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

              Pablo J. RoginaP Offline
              Pablo J. RoginaP Offline
              Pablo J. Rogina
              wrote on 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

              • Login

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