【问题标题】:Can the SqlDataAdapter refresh itself when the table is changed from an outside source?从外部源更改表时,SqlDataAdapter 可以自行刷新吗?
【发布时间】:2011-02-12 22:40:02
【问题描述】:

我的 SQL Server 表是从我的程序外部更新的(实际上是从一个 SQL 触发器),所以 DataSet 没有意识到有更改,并且我的 DataGrid 不会更新,除非我显式调用 SqlDataAdapter.Fill()再次(例如,使用“刷新”按钮或定时事件)。

ADO.NET 有没有一种方法可以订阅更改事件等以刷新自身?

【问题讨论】:

    标签: c# ado.net refresh sqldataadapter


    【解决方案1】:

    是的,使用Query Notifications。当数据集发生更改并再次运行查询时,您会收到回调。

    【讨论】:

    • 太棒了——我现在正在尝试。谢谢!
    猜你喜欢
    • 1970-01-01
    • 2010-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-05-17
    相关资源
    最近更新 更多