View Full Version : How to restore database created ?
Jugular
25th October 2012, 23:05
Hi.
I need some help to create a database in Qt, and restore this in the next execution of the program. I need to add objetcs in database and restore they in the next execution!
I created the database and inserted some information, but i don't know how i restore this information when the program is re-opened! May someone help me please?
BalaQT
26th October 2012, 07:26
Hi,
It seems u r new to programing.
I need some help to create a database in Qt
You cannot create database in Qt. You can use Qt to create database in Sqlite, mysql or sqlserver etc.
you need to look at QSqlDatabase.
I need to add objetcs in database and restore they in the next execution
please go through some basic sql commands and basic undertanding of database.
If you create a table in database. that will be there forever. unless you forget to commit or drop it manually.
but i don't know how i restore this information when the program is re-opened
You need to use select query and show it in your application.
steps:
1.create table
2.insert data [after this you can close the application. the data will be stored in database]
3.select data [you need to select the records from database]
4.show in your app
hope it helps
Bala
Gokulnathvc
26th October 2012, 10:20
In order to restore the values from the database while execution, you need to use the SELECT command of the database in the default constructor.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.