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 need a connection to my SQL database to my exam project
Forum Updated to NodeBB v4.3 + New Features

I need a connection to my SQL database to my exam project

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 199 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
    andreabicskei
    wrote on last edited by
    #1

    Hi, so I have a problem to connect my db to my project.
    In connection.h I have this:
    #ifndef CONNECTION_H
    #define CONNECTION_H
    #include <QSqlDatabase>
    #include <QSqlError>
    #include <QSqlQuery>
    #include <QtSql>
    #include <QFileInfo>

    class Connection
    {
    public:
    Connection();
    bool createconnect();
    void connclose();
    void connopen();
    };

    #endif // CONNECTION_H
    How can I connect the connection.h to my database, which name is "mydb"?
    I am kinda new and a bit lost in all this things and infos.
    Thank you!

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      It's perfectly described here which params you have to set.

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

      1 Reply Last reply
      4
      • K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

        Hi and welcome to devnet forum

        The best start for you would be using a Qt creator installation with appropriate Qt lib version. For a starter Qt version 5.15 for the Qt libs is better.

        There are a couple of example projects with SQL available. Try those.

        Vote the answer(s) that helped you to solve your issue(s)

        1 Reply Last reply
        1

        • Login

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