开发者

Update Gridview in realtime

I'm developing application WinForms .net 4.0 using C# and the backend is SQL Server 2008 the nature of the data for this app is to be displayed to the user in real time manner, whenever the data is changed or new data was added the UI has to reflect that in real time.

I'm trying to find out the best way to get the data from SQL without constantly 开发者_运维百科pooling from the server, I came to a few options:

  1. Create background thread to update the data. (I don't like pooling from the server)
  2. Use SQLDependency class to receive notification from the server.

What do you recommend, or if you have a better method it will be great if you can share it.


If you only have a few clients then a SQLDependency *might be an OK solution. However here is the Microsoft recommended approach for a full blown client/server application.

http://msdn.microsoft.com/en-us/library/ms187528.aspx

This approach is good for many clients but less frequent changes.

The last time I had this type of requirement for more frequent changes with a bunch of clients (i.e. thousands) we built a middleware service that we installed on the server which in turn broadcast the running changes from the database via socket.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜