Why is my Access database not up-to-date when I read it from another process?

后端 未结 3 1724
野趣味
野趣味 2020-12-19 11:56

In my application I do the follwing things:

  1. Open a Access database (.mdb) using Jet/ADO and VB6
  2. Clear and re-fill a table with new data
  3. Clos
3条回答
  •  佛祖请我去吃肉
    2020-12-19 12:14

    Just a guess but I might be due to the fact that the Jet engine features a read cache and lazy writes:

    How To Implement Multiuser Custom Counters in Jet 4.0 and ADO 2.1

    "Microsoft Jet has a read-cache that is updated every PageTimeout milliseconds (default is 5000ms = 5 seconds). It also has a lazy-write mechanism that operates on a separate thread to main processing and thus writes changes to disk asynchronously. These two mechanisms help boost performance, but in certain situations that require high concurrency, they may create problems."

    The article suggests using Jet's RefreshCache method and to set the Jet OLEDB:Transaction Commit Mode to 1 millisecond (one advantage for ADO over DAO for Jet is that you can alter this setting without changing the value in the registry).

    P.S. you should consider editing Access database (.mdb) to mention 'Jet' instead and using the 'Jet' tag too, otherwise you'll get a comment from a certain SO user who is pernickety about these things :)

提交回复
热议问题