Results 1 to 8 of 8

Thread: database

  1. #1
    Join Date
    Sep 2010
    Location
    Bangalore
    Posts
    169
    Thanks
    59
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Question database

    hi everyone!
    I have created a database and stored upto 10,000 records in it. The fields are id,name and address. Now i want to extract the required fields and store it in the corresponding variables(id,name,address).
    Well how to do it? i'm really confused. Can any one please help me?


    with regards,

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: database

    if u created it by SQL u can get it by SQL.. what is the problem exactly?

  3. #3
    Join Date
    Sep 2010
    Location
    Bangalore
    Posts
    169
    Thanks
    59
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: database

    Quote Originally Posted by MrDeath View Post
    if u created it by SQL u can get it by SQL.. what is the problem exactly?
    no no, what i want to say is that i don't know the exact code. I mean to say, please tell me all the syntaxes for performing the extraction operation from the database.

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: database

    Can I ask you some personal questions?
    How old are you? Is this homework?

    Getting information out of a sql database is very easy. There are millions, if not billions of articles on google. Let me give you one:

    http://www.w3schools.com/sql/default.asp

    As for using sql queries with Qt:
    http://doc.qt.nokia.com/4.6/qsqlquery.html

    Now, read those pages and if you still have a question, please ask.

  5. #5
    Join Date
    Sep 2010
    Location
    Bangalore
    Posts
    169
    Thanks
    59
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: database

    Quote Originally Posted by tbscope View Post
    Can I ask you some personal questions?
    How old are you? Is this homework?

    Now, read those pages and if you still have a question, please ask.
    Thanks tbscope for ur childish reply. But let me tell you that first of all i have no idea of sql database or sql language. I have begun directly from Qt.
    Secondly, the link that you have provided: http://doc.qt.nokia.com/4.6/qsqlquery.html, i have already gone through those pages. But there i find so many functions declared but so less explanation, that i really get confused as to which one to use and which one not to. That's why I seek out help in this forum to know the basic syntaxes as Qt is completely new to me. So if you have any links where explanations are also there regarding the predefined functions, then do send me. That could really help me. Now i hope you understand my problem rather than my age.
    Thanks for your concern.

  6. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: database

    The solution for your problem is well described in the Detailed Description of QSqlQuery (Or have a look at the examples of the QtSql Module). What else do you need to know? Also it would be nice if you could show us what you have so far.

    And the question if it is your homework was because we have the rule here, not to post solutions for homework. So you won't see any piece of code here! Also if you post some we can correct.

  7. The following user says thank you to Lykurg for this useful post:

    sattu (23rd September 2010)

  8. #7
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: database

    You need to have at least basic knowledge of SQL to use QtSql module. It is like using Qt without having knowledge of C++. But as your need is very simple, just go through the example programs provided with Qt. I m sure the examples will show u the way.

  9. The following user says thank you to nish for this useful post:

    sattu (23rd September 2010)

  10. #8
    Join Date
    Sep 2010
    Location
    Bangalore
    Posts
    169
    Thanks
    59
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: database

    Quote Originally Posted by Lykurg View Post
    The solution for your problem is well described in the Detailed Description of QSqlQuery (Or have a look at the examples of the QtSql Module). What else do you need to .....................t.
    Well that's fine! I didn't know about that rule. Actually it's difficult to tell how much i have learnt upto now. I think the more i get used to Qt, the more i will find it understandable. So let me wait for time. If i have any doubt or error in code i could surely ask for it. But if i don't find any required syntaxes then i think i just need to keep on searching for it. O.k thanks once again.

    With regards,

Similar Threads

  1. Replies: 9
    Last Post: 20th May 2010, 09:55
  2. Database
    By hazardpeter in forum Newbie
    Replies: 3
    Last Post: 19th December 2009, 17:48
  3. Using database
    By debmag in forum Newbie
    Replies: 2
    Last Post: 6th February 2009, 08:15
  4. Qt with Database
    By ederbs in forum Qt Programming
    Replies: 3
    Last Post: 23rd September 2006, 22:47
  5. Database example
    By marvaneke in forum General Discussion
    Replies: 3
    Last Post: 27th June 2006, 09:02

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.