从SQL DB自动刷新结果

问题描述:

伙计们
我想显示来自SQL表的最新结果,所以我必须获取更新,插入和删除记录的记录,然后更新我的datagrid视图.
如何经常获取更改的记录?
在我的情况下,计时器不会回答我.

hi guys
i wanna show latest result from a SQL table ,so i have to get records that updated,Inserted and deleted records then update my datagrid view.
how can i get the changed records frequentlly?
in my case ,timer wouldn''t answer me.

您需要实现某种通知服务,一旦数据更改,该服务就会更新客户端.

也许通知服务 [
You need to implement some sort of notification service that updates the client once data is changed.

Maybe Notification Services[^] can help you get to a solution.


为什么不来回答您的问题有问题吗?

如果您在修改后的数据库表上创建触发器,并设置一个指示最新数据库更改的datetime字段,并具有监视该日期时间的计时器,则可以查找"已更改的记录.

您可能还希望使用异步计时器(System.Threading.Timer)轮询"数据库以进行更改,并在发现更改时引发事件.

祝你好运,

爱德华
Why won''t a time answer your question?

If you create a trigger on the modified database table and set a datetime field indicating the latest database changes and have a timer monitoring that datetime, you''ll be able to ''find'' the changed records.

You may also want to use an async timer (System.Threading.Timer) to ''poll'' the database for changes and raise an event when a change is found.

Good luck,

Eduard


感谢Abhinav S并感谢爱德华
让我解释一下我要寻找的东西:
假设我有一个包含以下字段的表:

姓名|价格
____________
A | 200
B | 100
C | 300
.
.
.

1,它有10000多个记录.
2-记录总是在更改其数据.

问题在于更改UI上的输出的方式(例如DataGridView).

我只需要获取更新的记录,然后在UI上更新它们即可.(不更新我的所有UI(DataGridView))
希望因为我的英语不好而清楚:)
thanks Abhinav S and thanks Eduard
let me explain what i''m looking for:
suppose,i have a table with following fields:

Name | Price
____________
A | 200
B | 100
C | 300
.
.
.

1-it have more than 10000 records.
2-the records always changing their data.

the problem is the way for changing the output on UI(for example DataGridView).

i have to get only the updated records ,then update them on the UI.(not to update all my UI(DataGridView))
hope it clear because of my poor english :)