[.net] Database Woes (reading before writing)

Started by
6 comments, last by NickGeorgia 18 years, 9 months ago
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! :)
Advertisement
Guess I will just open and close sesame.. that works hehe... but slowwww...

Edit: Nope... nevermind
Doesn't the 'Commit' SQL command force it to update?
No, it doesn't.
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.
"Voilà! In view, a humble vaudevillian veteran, cast vicariously as both victim and villain by the vicissitudes of Fate. This visage, no mere veneer of vanity, is a vestige of the vox populi, now vacant, vanished. However, this valorous visitation of a bygone vexation stands vivified, and has vowed to vanquish these venal and virulent vermin vanguarding vice and vouchsafing the violently vicious and voracious violation of volition. The only verdict is vengeance; a vendetta held as a votive, not in vain, for the value and veracity of such shall one day vindicate the vigilant and the virtuous. Verily, this vichyssoise of verbiage veers most verbose, so let me simply add that it's my very good honor to meet you and you may call me V.".....V
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...


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.

This topic is closed to new replies.

Advertisement