QSqlDatabase mybase=QSqlDatabase::addDatabase("qsqlmysql");
mybase.setDatabaseName("mybase");
mybase.setUserName("root");
mybase.setPassword("mypass");
mybase.setHostName("127.0.0.1");
mybase.open();
QSqlQuery query("SELECT * FROM field1");
int k=0;
while (query.next()) {
QPixmap pixmap;
pixmap.loadFromData(query.record().value("Icon").toByteArray());
QString country = query.record().value("Name").toString();
k++;
}
QSqlError er = mybase.lastError();
er постоянно выдает ошибку "Driver not loaded"
уже находил решение:
You need to get the MySQL installation files. Run SETUP.EXE and choose "Custom Install".
Install the "Libs & Include Files" Module. Build the plugin as follows (here it is assumed that MySQL is installed in C:\MYSQL):
cd %QTDIR%\src\plugins\sqldrivers\mysql
qmake -o Makefile "INCLUDEPATH+=C:\MYSQL\INCLUDE" "LIBS+=C:\MYSQL\LIB\OPT\LIBMYSQL.LIB" mysql.pro
nmake
If you are not using a Microsoft compiler, replace nmake with make in the line above.
все сделал как пишет но не помогло.
Что делать ?