Originally Posted by
ChrisW67
You don't say how you are accessing the Cache database from Qt. Which driver?
I'm using the QODBC driver and the DSN driver is "InterSystems ODBC35" driver and Driver Version = 2012.1.2.702.0.
An how I fetch the result:
void ExecuteQuery()
{
m_db.setDatabaseName("InterSystems Caché DSN");
m_db.open();
if (!m_pQuery->exec("select * from Aviation.Aircraft")) // table of the SAMPLES database of an caché instance
{
QString sError
= m_pQuery
->lastError
().
text();
//m_sLogText = QString("<table><tr><td><b>%1</b></td><td><font color='#FF0000'>%2</font></td></tr></table>").arg(QDateTime::currentDateTime().toString("(hh:mm:ss)"), sError.replace('<', "<").replace('>', ">"));
//ODBC_Logging::getInstance()->WriteLog(ERROR, sError);
qDebug() << sError;
}
else
{
m_pSqlQueryModel->setQuery(*m_pQuery);
qDebug() << m_pSqlQueryModel->lastError();
}
}
void ExecuteQuery()
{
QSqlDatabase m_db = QSqlDatabase::addDatabase("QODBC3", "test");
m_db.setDatabaseName("InterSystems Caché DSN");
m_db.open();
QSqlQuery *m_pQuery = new QSqlQuery(m_db);
if (!m_pQuery->exec("select * from Aviation.Aircraft")) // table of the SAMPLES database of an caché instance
{
QString sError = m_pQuery->lastError().text();
//m_sLogText = QString("<table><tr><td><b>%1</b></td><td><font color='#FF0000'>%2</font></td></tr></table>").arg(QDateTime::currentDateTime().toString("(hh:mm:ss)"), sError.replace('<', "<").replace('>', ">"));
//ODBC_Logging::getInstance()->WriteLog(ERROR, sError);
qDebug() << sError;
}
else
{
m_pSqlQueryModel = new QSqlQueryModel();
m_pSqlQueryModel->setQuery(*m_pQuery);
QAbstractItemModel *m_pSQLResultTable = m_pSqlQueryModel;
qDebug() << m_pSqlQueryModel->lastError();
}
}
To copy to clipboard, switch view to plain text mode
I'm sorry I didn't provided these infos directly, I thought someone already worked with qt and the caché database and knows the problems when working with caché.
Bookmarks