PDA

View Full Version : Database access issue



Gayathri
23rd November 2006, 06:55
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?:o

sunil.thaha
23rd November 2006, 07:11
http://www.qtcentre.org/forum/f-general-discussion-10/t-database-access-from-qt-4565.html

Gayathri
23rd November 2006, 07:27
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?

sunil.thaha
23rd November 2006, 07:41
Do you mean that if a connection and datatable object created through the QT designer code will not work?


Could not get you :confused:

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



int main( ... ) {
QApplication app( .. );
// create a connection
if( ! connectToDatabase() ){
return 0;
}

// Creare and show the Window with dataaware widget and
// Hope things will work fine ^-^

return app.exec();
}