
Originally Posted by
fengtian.we
Can I use the Sql Module without chanage .pro file?
so ........... Can I use the Sql Module without chanage .pro file?
Before you connect on any sql device .. you can check:
std::cout << "### Your sql driver on bord are: " << qPrintable(drivers.join(" ")) << std::endl;
if (!drivers.contains("QMYSQL")) {
std::cout << "### Load QMYSQL Driver Fail!." << std::endl;
return;
}
QStringList drivers = QSqlDatabase::drivers();
std::cout << "### Your sql driver on bord are: " << qPrintable(drivers.join(" ")) << std::endl;
if (!drivers.contains("QMYSQL")) {
std::cout << "### Load QMYSQL Driver Fail!." << std::endl;
return;
}
To copy to clipboard, switch view to plain text mode
If the driver is load , you can use it.... if drivers.size() are 0 no driver sql on board .. so simple..
Bookmarks