SQLDependency_OnChange-Event fires only one single Time

后端 未结 6 833
故里飘歌
故里飘歌 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

    In your private void dep_OnChange(object sender, SqlNotificationEventArgs e) method after you unsubscribe the dep_OnChange event you should call the private void GetStates() again, to initialize the dep.OnChange event again.

提交回复
热议问题