Results 1 to 3 of 3

Thread: How to restore database created ?

  1. #1
    Join Date
    Oct 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Lightbulb How to restore database created ?

    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?

  2. #2
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: How to restore database created ?

    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

  3. #3
    Join Date
    Mar 2011
    Location
    Coimbatore,TamilNadu,India
    Posts
    382
    Thanks
    10
    Thanked 13 Times in 12 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to restore database created ?

    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.

Similar Threads

  1. Replies: 0
    Last Post: 18th September 2012, 15:50
  2. Database not being created
    By Splatify in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2011, 00:31
  3. Save and restore QByteArray in mysql database
    By ruben.rodrigues in forum Newbie
    Replies: 0
    Last Post: 9th August 2010, 09:43
  4. How to BackUp DataBase and Restore it Use QSqlDataBase?
    By litterflybug in forum Qt Programming
    Replies: 1
    Last Post: 6th December 2009, 04:34
  5. GUI created from Database
    By NoRulez in forum Qt Programming
    Replies: 1
    Last Post: 3rd February 2009, 00:43

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.