Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

c# threading with database

Posted on 2014-03-24
4
Medium Priority
?
283 Views
Last Modified: 2014-04-09
Hi

I have a c#2010 winforms application  connected to an access database

The database is networked, and occasionally when something is updated in the database, then displayed back on screen... the update does not appear to have been actioned because the screen displays the old data, even though the screen has re-queried the database for the fresh data.

Is this just something that I am going to have to live with?  I have tried putting a 3 second delay before re-displaying the data, but even this does not always give enough time..

public void wait(int seconds)
{
    System.Threading.Thread.Sleep(seconds * 1000);
}

Open in new window



my code works as follows:

update the record
wait for 3 seconds
re-query the database and display the results.


so, my question is, does pausing the application like above, also pause the update to the database?
0
Comment
Question by:cycledude
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 21

Expert Comment

by:Dale Burrell
ID: 39949922
I don't think the pause is relevant as in you shouldn't need to do it and it probably won't help.

Unless I am mistaken the update won't return until its complete. So if you're then reading invalid data that makes me think the data has been cached somewhere as opposed to an out of date read.
0
 

Author Comment

by:cycledude
ID: 39949957
Hi Dale

Thanks for the info.

when you say cached, do you mean externally to the application?  I have not implemented any caching in the system (I wouldn't know how to!)
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 1500 total points
ID: 39949987
what kind of database? if it's ms access, yes sometimes the db layer does not return the data "updated" immediately.
the only "real" solution is to change the ms access db to some REAL database...
0
 

Author Closing Comment

by:cycledude
ID: 39989806
I guess using a different database will be the best solution... but thats a long termchange
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question