开发者

Checking for database changes at set intervals in ASP.NET page

I have an ASP.NET page which contains a large number of gridviews, which contain masses amount of 开发者_C百科data which take a fair while to rebind. I currently have it set so the gridviews are only bound when the account number is changed (on the page, the user searches for an account which then displays their information).

I'd like it to be able to monitor a database table (hashing it maybe?) every few minutes, then if there are changes spawn a popup box informing them, and an option to have the gridviews refreshed.

Firstly, is this possible in ASP.NET/C#? Secondly, what would the performance impact be on the page checking the hash/checking for changes in a large DB table?

Thanks


Firstly, is this possible in ASP.NET/C#?

It's possible to periodically check for updates, and there are more than one ways to do it:

  • Pooling for changes - Periodically checking for changed data, by using rowversions, timestamps, other change tracking mechanism like SQL Server Change tracking
  • Getting notifications for changes - By using a change notification mechanism like Service Broker, or SqlDependency

Secondly, what would the performance impact be on the page checking the hash/checking for changes in a large DB table?

The performance impact depends heavily on the DB model, the chosen mechanism, the volume of updates etc.

You can have a very robust and fast change tracking system by using the proper technologies that fit your application requirements, or you can have a very slow and heavy tracking system by not doing so.

It all depends on the data model, the way change tracking is done, (the fastest solution for your data shape should be chosen), the amount of database updates and concurrency, the volume of updated data. Etc.

My suggestion is to experiment with different change tracking mechanisms, do some tests, read about alternatives etc, and in the end chose the right solution for your application.


If you are using SQL-Server (you did not precise which DB you are using), have a look at SQLDependency.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜