修改系统工程文件
其中数据库类型为 QODBC
DBName为所配置的ODBC数据源名称
QString QString DBName("test2031");("test203");
QSqlDatabase m_SqliteDB = QSqlDatabase::addDatabase("QODBC", "AgentClient" + QDateTime::currentDateTime().toString());
m_SqliteDB.setDatabaseName(DBName);
if (!m_SqliteDB.open())
{
qDebug("Open Database:%s Error:%s",DBName.toLocal8Bit().data(),m_SqliteDB.lastError().text().toLocal8Bit().data());
QMessageBox::critical(0, "DataBase Error", m_SqliteDB.lastError().text() );
qDebug()<<:drivers>
}else
{
qDebug("Connect to ODBC Data Sourcesuccessfully");
}