Results 1 to 4 of 4

Thread: Database access issue

  1. #1
    Join Date
    Nov 2006
    Posts
    16
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Post Database access issue

    Hi,
    I had connected to MYSQL database. I had used the databasetable object to get connected to the database table. this works good in preview mode. but this does not work when i execute from the command prompt. Gives me the error
    Qcursor:: set name :unable to build record ,does table exit.
    warning was an error occured while accessing the database.
    and nothing was displayed in the database.

    Do any body have the idea why this issue comes?

  2. #2
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Database access issue

    We can't solve problems by using the same kind of thinking we used when we created them

  3. #3
    Join Date
    Nov 2006
    Posts
    16
    Thanks
    3
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Post Re: Database access issue

    Hi Sunil,
    Came across the forum replied already. Do you mean that if a connection and datatable object created through the QT designer code will not work?

  4. #4
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Database access issue

    Do you mean that if a connection and datatable object created through the QT designer code will not work?
    Could not get you

    Anyway,
    Suppose you have made the connection in the designer. Thne that connection will only be used by with the designer. And no information about the connection gets written in the ui file. Onlt the information about the data-aware widgets are stored

    So when you actually run the application, the uic does not generate a code to connect to the database. Instead we should make a connection to the database. and then things will work fine. Normally, in the main function we will call a connectToDatabase function
    Qt Code:
    1. int main( ... ) {
    2. QApplication app( .. );
    3. // create a connection
    4. if( ! connectToDatabase() ){
    5. return 0;
    6. }
    7.  
    8. // Creare and show the Window with dataaware widget and
    9. // Hope things will work fine ^-^
    10.  
    11. return app.exec();
    12. }
    To copy to clipboard, switch view to plain text mode 
    We can't solve problems by using the same kind of thinking we used when we created them

  5. The following user says thank you to sunil.thaha for this useful post:

    Gayathri (23rd November 2006)

Similar Threads

  1. Database access from Qt
    By nimmyj in forum Qt Programming
    Replies: 1
    Last Post: 23rd November 2006, 06:51
  2. Database access from Qt
    By nimmyj in forum General Discussion
    Replies: 1
    Last Post: 16th November 2006, 14:11
  3. Replies: 1
    Last Post: 4th October 2006, 16:05
  4. Issues regarding QMySql drivers and mysql database
    By bera82 in forum Qt Programming
    Replies: 2
    Last Post: 10th August 2006, 17:50
  5. Filling combobox from database
    By Philip_Anselmo in forum Qt Programming
    Replies: 3
    Last Post: 11th May 2006, 17:53

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.