1

I am using borland 6 and sdac5.0 for interaction with MS Access database. However, when I insert a record into the database and try to fetch all data for that table within the same connection, the newly inserted data is not shown.

I have noticed that there was a bug in MS Access Jet4.0 regarding this issue. (https://support.microsoft.com/kb/239114) Unfortunately my system is Windows 7 and I have checked the Jet.dll and I have confirmed that's the latest version and Microsoft has confirmed the issue is solved.

Just wondering is there any method to force the database to update the data to the hard disk? I can sacrifice some performance in order to ensure the integrity of the data.

user2984297
  • 353
  • 1
  • 3
  • 14
  • Have you tried explicitly closing the connection after the insert and then re-opening it for the read to see if that makes any difference? – Gord Thompson Dec 01 '14 at 22:29
  • @GordThompson yeah i have tried it and seems like the record is still missing. But after a while, doing the same fetch operation, it shows all the record that has been added during this period – user2984297 Dec 01 '14 at 23:27
  • I'm afraid that I can't offer any specific insights about how "sdac5.0" manages connections, but the related question [here](http://stackoverflow.com/q/17048114/2144390) might be of interest. – Gord Thompson Dec 02 '14 at 00:04
  • @GordThompson I try your suggestion to close the connection and reopen it. And it does make the database to "update" the new record. If you would like to answer it. I will accept it as an answer. Many thanks for your help. – user2984297 Dec 02 '14 at 20:49

1 Answers1

0

Similar to the related question here, under certain circumstances it may take approximately 5 seconds for a newly-inserted row to be visible in an Access database. This is presumably because Access databases are shared-file databases and the Access Database Engine may make some effort to "batch" commits rather than hit the database file the instant it receives an INSERT/UPDATE query.

To make the update "immediately" available to all users (other connections) we can force the change back to the database file by simply closing the connection from which we performed the update.

Community
  • 1
  • 1
Gord Thompson
  • 116,920
  • 32
  • 215
  • 418