SQLDependency_OnChange-Event fires only one single Time

后端 未结 6 837
故里飘歌
故里飘歌 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 22:03

    In GetStates() :

    SqlDependency.Stop(con); SqlDependency.Start(con);

    these lines should be executed only when registering the sql dependency for first time.

    Restrict them when you call the method from OnChange event.

提交回复
热议问题