Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Database data media error by setRecord via ODBC
Forum Updated to NodeBB v4.3 + New Features

Database data media error by setRecord via ODBC

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 750 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Andy314A Offline
    Andy314A Offline
    Andy314
    wrote on last edited by
    #1

    Hello,
    I work with a MS-Access-Database via ODBC driver. All worked perfectly for many months. Now I get sometimes the following error:

    [Microsoft][ODBC-Treiber für Microsoft Access] Datenträger Ein-/Ausgabefehler während des Einlesens. QODBC3: Unable to execute statement
    I translate the German part of the message:
    "Data media error I/O-error during reading in"

    It looks that we have a harddisk or network problems during a file operation. (the Access-DB in on the server)

    What is unexpected for me is the Qt function that produces the error: setRecord or insertRecord

    QSqlTableModel t(NULL, myDB);
    t.setTable(tblname);
    ok=t.select();
    
    QSqlRecord rec;
    //// fill record  fields
    ok=t.setRecord(0, rec);       // -> here I get the error
    // or  ok=t.insertRecord(0, rec);           
      if(!ok)
                {  // error-ouput -> exit }
       ok=t.submitAll();
    

    Makes setRecord something with the real database file ?
    I thought the setRecord/insertRecord work only in RAM and fills only the logical representation of the record in the memory.
    Only submitAll() make a data transport to the real database file and can produce a file error!

    Do I misunderstand it completely ?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      It depends on the edit strategy. AFAIK, by default it's OnRowChange for the QSqlTableModel.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      Andy314A 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        It depends on the edit strategy. AFAIK, by default it's OnRowChange for the QSqlTableModel.

        Andy314A Offline
        Andy314A Offline
        Andy314
        wrote on last edited by
        #3

        @SGaist said in Database data media error by setRecord via ODBC:

        Hi,

        It depends on the edit strategy. AFAIK, by default it's OnRowChange for the QSqlTableModel.

        Ok, I have checked it. I have switched it to OnManualSubmit. Now, I get on submitAll() the error. That is clear now, nevertheless I get this error.

        I looked with the "Process Monitor Tool" on the Access database file during my running application and found that there is an periodical reading access every 500 ms the whole time.
        This is unexpected for me again. The program "stands" and performes no database action. It only has connected to the DB and hold the connection (dont close it).
        I this the normal behavioral the a QSqlDatabase or is somesthing wrong here ???

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          I haven't used that plugin so I can't comment on that behaviour.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved