Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Database and storing information
Qt 6.12 LTS is out! See what's new in the release blog

Database and storing information

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.3k 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.
  • P Offline
    P Offline
    Project try
    wrote on last edited by
    #1

    Hey guys..

    I've been thinking of learning how to create a database and connect it to Qt so I can use it , but I can't find any tutorial that shows you how to add info to it.

    for example , suppose I have a database with a few tables one of the tables has these data , and it name is " information ":
    1- first name
    2- id number
    3- email

    How can I let the user like when he presses the " add information button " then it shows a window that he can put the three info in the data's table " information " and stores it and deletes it if he wanted to.

    if someone has a link to a good tutorial , please submit it.

    Thanks a lot.

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

      Hi project try
      1- you have to connect to the database
      2-you have to create a query
      @QSqlQuery query;@
      and exec your query for exemle:
      @query.prepare("INSERT INTO utilisateurs ( identificateur , password) VALUES ('nice', '6')");@
      @query.exec();@
      3-close the connection
      I hope that's help you

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Have a look at the SQL examples in Qt's documentation. "This one":http://qt-project.org/doc/qt-5/qtsql-masterdetail-example.html shows how to do what you want.

        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
        0
        • P Offline
          P Offline
          Project try
          wrote on last edited by
          #4

          Thanks guys , you helped a lot ^^

          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
          • Unsolved