Database and storing information

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

  • 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')");@
    3-close the connection
    I hope that's help you

  • Lifetime Qt Champion


    Have a look at the SQL examples in Qt's documentation. "This one": shows how to do what you want.

  • Thanks guys , you helped a lot ^^

Log in to reply