如何在数据库中的值更改时更新网格 [英] How to update grid when values in database changes
问题描述
我正在开发一个使用c#作为前端而SQL Server 2005作为后端的Windows应用程序。
我有网格显示来自数据库的值。当且仅当数据库中的值发生变化时,我的任务是更新网格中的值。
我已尝试过thread,sqlDependency和signalR,虽然它是针对ASP.NET的。我也研究过观察者设计模式,但我并不完全理解id的作用,我也尝试了事件通知和服务经纪人
在这两种情况下网格都保持清爽这是不希望的。有什么方法可以解决我的问题吗?
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowupdating.aspx#Y456 [ ^ ]
http:// www.c-sharpcorner.com/Forums/Thread/40936/ [ ^ ]
http://devilswork.wordpress.com/2009/03/27/gridview-row-edit-delete-and-update/ [ ^ ]
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?
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowupdating.aspx#Y456[^]
http://www.c-sharpcorner.com/Forums/Thread/40936/[^]
http://devilswork.wordpress.com/2009/03/27/gridview-row-edit-delete-and-update/[^]
这篇关于如何在数据库中的值更改时更新网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!