Solved

c# threading with database

Posted on 2014-03-24
4
281 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 500 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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

688 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