PDA

View Full Version : Connect database mysql by QTdedign???



multsyh
10th June 2004, 02:50 PM
I coding on QTdesign but I can't connect database mysql. When I connect by qtdesign then error "Driver not loader". I used Mysql 3.x and use Driver "QMYSQL3" and I sure runing mysql. Anyone help me plz. Thanks
I try coding but I can't:
void MyForm::ConnectDBTry()
{
// create the default database connection

QSqlDatabase *defaultDB = QSqlDatabase::addDatabase( "QMYSQL3" );

if ( ! defaultDB ) {
QMessageBox::information(this,"Application name",defaultDB->lastError().driverText() );
return;
}
defaultDB->setDatabaseName( "test" );
defaultDB->setUserName( "multsyh@hueitech" );
defaultDB->setPassword( "1234567890" );
defaultDB->setHostName( "hueitech" );
if ( ! defaultDB->open() ) {
QMessageBox::information(this,"Application name", "Database not open" );
return;
}
QMessageBox::information(this,"Application name", "Connect success!");
}:confused:

multsyh
11th June 2004, 04:28 PM
why don't question anyone for multsyh