Click here to Skip to main content
15,914,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing a windows application using c# as front end and SQL server 2005 as back end.

I have grid which shows values from database. My task is to update values in grid if and only if values in database changes.

I have tried thread, sqlDependency and signalR though it is for ASP.NET. I have also studied observer design pattern but i didn't understand exactly what id does, I have also tried event notification and service broker

In both the case grid keeps refreshing which is not desired. Is there any way to solve my problem?
Posted
Comments
Anurag Sinha V 11-Sep-13 2:55am    
How is your DB getting updated?
Is it manual or via a job or something?
Sandeep_Gosavi 11-Sep-13 3:00am    
it will be updated by manually and through same application but on remote machine
Anurag Sinha V 11-Sep-13 4:25am    
Then my friend you can try something like below:
have the update statements in a batch, put them in a stored procedure and have a variable act as a flag. I mean to say, when all the updates are successfully executed, set the flag variable as 'Success' or anything else.
In your UI code, check the flag value and then retrieve the updated data set from the Db and bind your gridview.
Its just an idea, I know you will have your questions, but keep this as a reference and try to build something with the above idea in mind.

-Anurag
Sandeep_Gosavi 11-Sep-13 5:36am    
yes i will definitely try this too. Thanks

1 solution

 
Share this answer
 
v2
Comments
Sandeep_Gosavi 11-Sep-13 3:09am    
My requirement is to update grid automatically upon changes made in database. It is easy to reload dataset and attach to grid again but how to monitor changes in database.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900