Umar Abbas
Umar Abbas

Reputation: 4161

Datagridview in winforms application updated automatically when there is any change in database

I am working on a winforms c# application which is using the technologies like Entity Frame work-code first.i have to make a form in which records from database continuously should shown.first i apply a simple timer technique which updates Grid and other control after 5 sec. but it is too much expensive and eat resources.

i want to ask is there any other sophisticated method by which data in DGV and other controls automatically updated if any change happen in Database.

Upvotes: 3

Views: 852

Answers (1)

user1017882
user1017882

Reputation:

http://dotnet.dzone.com/articles/c-sqldependency-monitoring

Look into SQLDependency. It is designed for this exact scenario.

There is a DataChanged event handler.

I used it very recently on a project for showing 'live' data from our TFS server and it's working very well.

Upvotes: 2

Related Questions