Hello.

I execute a database query (MSSQL / ACCESS), get data. If someone changed this data after my request, I will not find out. How can the application know about it right away? Option: every x seconds to update the request - somehow not very good.

Maybe there are other ways? For example, VKontakte news and the rest loads in real time - does it make requests every few seconds or is there another mechanism? (my program is not web - C # WPF)

Thank you in advance.

    2 answers 2

    To receive notifications from MS SQL in ADO.NET there is a class SqlDependency .
    You can also see the Notification of queries in SQL Server

      In great detail about all the ways to track changes are listed in the response to stackoverflow.com. Of the most used methods, you can select

      1. database notifications based on SqlDependency (see the MaLS response). Examples here and here .
      2. peg the necessary database tables every few seconds and check the CHECKSUM and an example is described here .

      Choose what suits you best. Notifications require more labor, but more elegant, and constantly polling the base will not be difficult to implement, but hardly suitable for large bases.