问题
My SQL Server table is updated from outside of my program (from a SQL trigger, actually), so the DataSet doesn't realize that there are changes and my DataGrid doesn't update unless I explicitly call SqlDataAdapter.Fill() again (e.g. with a "Refresh" button or a timed event).
Is there a way that ADO.NET can subscribe to change events or such so that it refreshes itself?
回答1:
Yes, using Query Notifications. You get a callback when the dataset has changed and you run your query again.
来源:https://stackoverflow.com/questions/2722744/can-the-sqldataadapter-refresh-itself-when-the-table-is-changed-from-an-outside