Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2003
    Posts
    4

    Exclamation Unanswered: Stale data reading MS Access DB

    I have 2 applications using an access .MDB database at the same time. One app will update a row and then signal the other that the row has been changed. The other app then opens a recordset and reads the row by using a SELECT query on the row's primary key.

    Here is the problem: The row that I read out has stale data, as if the update had not happened yet. I can put in a Sleep(1000) before opening the recordset, and then it works - but this is a totally unacceptable hack.

    I'm using ODBC with MDAC 2.7. Any ideas??

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    What language are these 2 apps written in? Is it VB/VBA? If so, you're outta luck ... There's a 6 sec delay on writes using ADO in VB. It's the driver. With VC++ the ADO driver is almost instantaneous ...

  3. #3
    Join Date
    Oct 2003
    Posts
    4
    Originally posted by M Owen
    What language are these 2 apps written in? Is it VB/VBA? If so, you're outta luck ... There's a 6 sec delay on writes using ADO in VB. It's the driver. With VC++ the ADO driver is almost instantaneous ...
    I am using C++... I am using a DSN-less connection string like this : "Driver={Microsoft Access Driver (*.mdb)};Dbq=blah.mdb;Uid=admin;Pwd="

    Is there some option I can use in the string? Or am I running into the "almost" part of the almost instantaneous writes that you mentioned?

    Thanks!

  4. #4
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Are you using the import directive for msado25.dll? If not do so ... The methods you use in there have no delay ... I don't have any sample code here to explain what I'm talking about ...

    Oh, I forgot ... DSN or not (using the explicit provider as you are) doesn't affect the writes to the database ...

  5. #5
    Join Date
    Oct 2003
    Posts
    4
    Originally posted by M Owen
    Are you using the import directive for msado25.dll? If not do so ... The methods you use in there have no delay ... I don't have any sample code here to explain what I'm talking about ...

    Oh, I forgot ... DSN or not (using the explicit provider as you are) doesn't affect the writes to the database ...
    Thanks for the reply.

    I'm not using ADO at all, I'm using ODBC.

    The only solution I have found is to close the database after the Update, and then signalling the other process to read. It seems to work but it is ugly. There is a connection string setting called "ImplicitCommitSync", however it does nothing.

  6. #6
    Join Date
    Oct 2003
    Posts
    4
    FYI, if anyone else has this problem, I solved it by using a transaction to do the write and then committing the transaction before signalling the other process to read. According to the docs, Access transactions are synchronous, so this is the correct solution.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •