SQLDependency_OnChange-Event fires only one single Time

后端 未结 6 832
故里飘歌
故里飘歌 2020-12-30 21:10

I\'m working with SQLDependency to notify me if there is a change in the Database. After Program Start-Up it works just fine. When I make a first change the Event fires. Wo

6条回答
  •  攒了一身酷
    2020-12-30 21:58

    I was running into this issue as well. You need to create a new SqlDependency entity (after unsubscribing the existing one from the OnChange event) and then run a new ExecuteReader command. I got the idea from this post:

    http://www.codeproject.com/Articles/12335/Using-SqlDependency-for-data-change-events

    This usually makes sense, as once you have been notified of a change you will normally want to re-query the data.

提交回复
热议问题