3

I'm using Sql Dependency to notify changes when they occur. But is there any way that I can identify the ID of a particular record(s) that has changed.

Here is the dependency change callback function which I'm using right now.

    private static void onDependencyChange(Object o, SqlNotificationEventArgs args)
    {
        //
    }

In both the callback arguments, I can't find anything which would give details about the changed record. Does anyone know of a solution or a work around ?

iJade
  • 23,144
  • 56
  • 154
  • 243
  • 1
    [This answer](http://stackoverflow.com/a/14877751/1048425) would suggest that you can't get the record(s) that have changed. The suggested workaround is a `ModifiedDateTime` field, then you would need to retrieve rows modified after a certain point. – GarethD May 21 '15 at 11:34
  • Is there any official documentation which says that we cant get changed records details using SQL Dependency ? – iJade May 21 '15 at 11:43
  • 1
    There is the documentation for [SqlNotificationEventArgs](https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlnotificationeventargs%28v=vs.110%29.aspx), it does not list the things you can't get from it (this would be a fairly exhaustive list), but it does list the things you obtain from it, and the data that has changed is not one of the things that you can retrieve. – GarethD May 21 '15 at 11:57
  • I am curious if the data cannot be retrieved (so what is the sql dependecy used for ... In oracle - the sql dependency can retrieve the rowid, and I at least can know which record exactly changed. – Eitan Oct 03 '17 at 12:27

0 Answers0