[.net] Database Woes (reading before writing)
I am having a little trouble with working with a database and wonder if anyone might know a solution. I am using a MS Access database and the Jet driver. Also I am using OleDbConnection, OleDbCommand, ExecuteNonQuery()... etc. (not using DataSet)
Right now, I can read and write to a database no problem. However, I am doing this rather quickly. For example, I write to the database then immediately read from it. The database cache isn't updating the database file in time so the old information is read.
Is there any way I can force the database cache to update the database file? Or is there any way I can check that the database cache has written the data to the database file?
Thanks in advance! :)
Guess I will just open and close sesame.. that works hehe... but slowwww...
Edit: Nope... nevermind
Edit: Nope... nevermind
No, it doesn't.
Commit confirms (ends successfully) a running transaction.
So it might help.
Cheers
Commit confirms (ends successfully) a running transaction.
So it might help.
Cheers
Quote:Original post by NickGeorgia
Guess I will just open and close sesame.. that works hehe... but slowwww...
Edit: Nope... nevermind
Do you mean that closing then re-openning the database doesn't force the data to be updated? If so I'd be checking that the update command was actually successful.
I tried both Commit in a transaction and opening and closing a database. Either one doesn't force the database cache to write. The data is written later after the timeout I believe. Anyway, I believe I could use the old recordsets and update with lockpessimisstic or lockoptimistic. If that doesn't work I think I can use datasets and look for an event.
Quote:Original post by NickGeorgia
I am having a little trouble with working with a database and wonder if anyone might know a solution. I am using a MS Access database and the Jet driver. Also I am using OleDbConnection, OleDbCommand, ExecuteNonQuery()... etc. (not using DataSet)
Just a thought - are you reading it from the same command object? If so, make sure you create a new one for the reader...
can you paste your code? It might help a bit...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement