QMainWindow (parent),
UI (new UI: : MainWindow)
{
The UI - & gt; SetupUi (this);
QStringList strList=QSqlDatabase: : drivers ();
Foreach (QString STR, strList)
QDebug () & lt; & lt;" \ t "& lt;
* "QSQLITE"
* "QMYSQL"
* "QMYSQL3
"* "QODBC"
* "QODBC3
"* "QPSQL
"* "QPSQL7
"*/
The db=QSqlDatabase: : addDatabase (" QODBC ");
QDebug () & lt; & lt;" Loading ODBC Driver success?"
Db. SetDatabaseName (DSN);
Bool isOK=db. The open ();
QDebug () & lt;
{
QMessageBox: : critical (0, tr (" open the database error "), the tr (" cannot establish a database connection \ n "), QMessageBox: : Cancel);
}
CodePudding user response:
The building Lord solved? I also encountered this problem, the solution is