[Qt-interest] could not able to open mysqlsql database

Yuvaraj R yuvaraj at ongobiz.com
Wed Sep 30 20:04:14 CEST 2009


Hi All

I could not able to open  mysql  database..

please help me

my connection code is :

QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL");

db.setDatabaseName("Addu");

db.setHostName("localhost");

db.setUserName("root");

db.setPassword("root");

db.setPort(3306);

if (!db.open()) {

QMessageBox::critical(0, qApp->tr("Cannot open database"),

qApp->tr("Unable to establish a database connection.\n"

"This example needs SQLite support. Please read "

"the Qt SQL driver documentation for information how "

"to build it.\n\n"

"Click Cancel to exit."), QMessageBox::Cancel);

return false;

}

return true;

}


Please help me


I am struggling since last two days ..


Thanks


Yuvaraj R
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090930/4bd28239/attachment.html 


More information about the Qt-interest-old mailing list