Thread
:
Nokia N900 Qt With Mysql Support
View Single Post
dtparikh
2011-06-07 , 05:04
Posts: 141 | Thanked: 41 times | Joined on Apr 2011 @ Ahmedabad, India
#
2
Can you run the below code to verify that the required drivers are installed ?
#include <QCoreApplication>
#include <QSqlDatabase>
#include <QSqlError>
#include <QStringList>
#include <QtDebug>
int main( int argc, char **argv )
{
QCoreApplication app( argc, argv );
qDebug() << QSqlDatabase::drivers();
QSqlDatabase db( QSqlDatabase::addDatabase( "QMYSQL" ) );
qDebug() << db.lastError();
}
If the output of this code shows that drivers are installed, then make sure you create QApplication or QCoreApplication instance before you use classes from the QtSql module.
If the instance is created at a later stage, then also it throws such errors
Quote & Reply
|
dtparikh
View Public Profile
Send a private message to dtparikh
Find all posts by dtparikh