PDA

View Full Version : Giup to voi!!! QTDesign trong Linux ket noi database mysql tai sao loi???



multsyh
05-06-2004, 20:00
To lam mai ma ko duoc tuc qua troi a. Co ai biet xin chi giup nhe Cam on cac bac nhieu.
To lap trinh QT Design tren Linux(Redhat 10) nhung khi Connect Database thi no bao loi do Driver khong dung. (Driver not loader). To dung MySQL 3.24.58 Va dam bao la da start MySQL. Dung Driver la QMYSQL3 nhu trong help do nhung ma ko the ket noi duoc ko hieu tai sao. Mong anh em giup do nhanh nhe vi to dang can lam do
To viet doan ma the nay nhung bi loi (Driver not loader) mong cac bac chi giao

#include <qsqldatabase.h>
#include <qmessagebox.h>
void Form5::ConnectDBT()
{
// create the default database connection
QSqlDatabase *defaultDB = QSqlDatabase::addDatabase( "QMYSQL3" );
if ( ! defaultDB ) {
QMessageBox::information(this,"Application name",defaultDB->lastError().driverText() );
return;
}
defaultDB->setDatabaseName( "Partner" );
defaultDB->setUserName( "multsyh@localhost" );
defaultDB->setPassword( "1234567890" );
defaultDB->setHostName( "Hueitech" );
if ( ! defaultDB->open() ) {
QMessageBox::information(this,"Application name", "Not Open Database" );
return;
}
QMessageBox::information(this,"Application name", "Connect OK");
}

Chan thanh cam on