Transactions in Microsoft Access
Hi guys.
I have a database (.mdb) and I connect to it from my QT application. I do not have problems to read the data but when I save it, I want to do it through a transaction and I can not because I'm having an error. I paste how I open the connection and how I launch the transaction:
The connection:
Code:
QString strPathDDBB
="DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=" + QCoreApplication::applicationDirPath() + "/galibo.mdb";
m_db.setDatabaseName(strPathDDBB);
if (!m_db.open()) {
}
The transaction:
Code:
bool feature
= m_db.
driver()->hasFeature
(QSqlDriver::Transactions);
if (!m_db.transaction())
{
error = "An error occurred while creating the transaction in the database\n";
error += m_db.lastError().text();
return false;
}
The feature variable returns true and the text error is "[Microsoft] [Microsoft Access ODBC Driver] Unable to define attribute now QODBC3: Unable to disable autocommit"
Any ideas?
Re: Transactions in Microsoft Access
I have already found out the reason for the error. The transaction is launched in the process of saving the application. Before this process, a series of consultations are made in the process of reading the information. Well, if in each query, the resources are not released through finish() method of the QSqlQuery class, then, when the transaction is launched, the commented exception is skipped.
Thank you