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. Problem when connection to my SQL database to my exam project
Qt 6.11 is out! See what's new in the release blog

Problem when connection to my SQL database to my exam project

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 195 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
    gmgiadinh176
    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 Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      What did you do/tried so far? Did you follow the documentation?

      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
      3

      • Login

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