PDA

View Full Version : Help,driver not loaded!



vencent
25th December 2007, 12:41
I use the VS2005 and QT4.3.0,

and i an sure that the file "qsqlodbc4.dl" is in the path "C:\Qt\4.3.0\plugins\sqldrivers"

and the project is easy:


#include <qtsql>

int main(int argc, char *argv[])
{
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
return 0;
}

it can pass the linking , but when it run ,the qdebug show that "QODBC driver not loaded" and "available drivers : (nothing here)"

i don't why this happy!

someone can help me?

marcel
25th December 2007, 12:52
A QApplication object must be instantiated before using any of the Qt API or objects.
Once you instantiate a QApplication object certain Qt internal things are setup.

Try with:



#include <QApplication>
#include <qtsql>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QSqlDatabase db = QSqlDatabase::addDatabase("QODBC");
return app.exec();
}

vencent
26th December 2007, 01:20
thank you so much

i am a beginner.