Jump to content
  • Advertisement
Sign in to follow this  
NickGeorgia

[.net] Database Woes (reading before writing)

This topic is 4772 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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! :)

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Doesn't the 'Commit' SQL command force it to update?

Share this post


Link to post
Share on other sites
No, it doesn't.
Commit confirms (ends successfully) a running transaction.

So it might help.

Cheers

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...


Share this post


Link to post
Share on other sites
Thanks for the help. I decided to put this problem on hold to work on a few other things. I'll come back to it after I tried the other things I was talking about.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!