Results 1 to 2 of 2

Thread: Transactions in Microsoft Access

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2015
    Posts
    17
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default 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:
    Qt Code:
    1. m_db = QSqlDatabase::addDatabase("QODBC");
    2. QString strPathDDBB="DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=" + QCoreApplication::applicationDirPath() + "/galibo.mdb";
    3. m_db.setDatabaseName(strPathDDBB);
    4. if (!m_db.open()) {
    5. QMessageBox::critical(0, QObject::tr("Database Error"), m_db.lastError().text());
    6. }
    To copy to clipboard, switch view to plain text mode 
    The transaction:
    Qt Code:
    1. bool feature = m_db.driver()->hasFeature(QSqlDriver::Transactions);
    2. if (!m_db.transaction())
    3. {
    4. error = "An error occurred while creating the transaction in the database\n";
    5. error += m_db.lastError().text();
    6. return false;
    7. }
    To copy to clipboard, switch view to plain text mode 

    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?
    Last edited by PinTxO; 29th May 2018 at 08:46.

Similar Threads

  1. Connect to Microsoft Access 2010 *.accdb file
    By FuNkDaDdY in forum Newbie
    Replies: 11
    Last Post: 26th April 2018, 08:43
  2. Slow Microsoft Access QSqlQuery (possible bug)
    By yeikos in forum Qt Programming
    Replies: 0
    Last Post: 12th May 2014, 10:55
  3. select and edit like Microsoft Access with cute sql?
    By Everall in forum Qt Programming
    Replies: 4
    Last Post: 19th December 2010, 11:37
  4. Replies: 10
    Last Post: 30th September 2010, 06:16
  5. how to connect to a microsoft access database?
    By mismael85 in forum Qt Programming
    Replies: 3
    Last Post: 7th March 2008, 09:25

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.