开发者

Polling the database in a background worker thread - .NET

I am new to .NET ... I am trying to create a background worker thread that can poll the database every 20s to find out whether the data in the database has changed or not.

What are the steps require开发者_运维技巧d to do this? Is this a good approach or should i use something else?

Any tutorial/example will be appreciated


Polling a database can be a large performance issue. If you have control over the service that updates the database, I would suggest issuing an event from that service to any client/service that might be interested in knowing the db has changes for a specific record.

Otherwise, you can look into using a background thread. To do that, simply create a thread using System.Threading.Thread. If you are connecting to a MS SQL Server database, you can use System.Data.SqlClient classes.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜