SQLDependency_OnChange-Event fires only one single Time

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

    Not sure if that is your problem but you dispose the command right after you have created it:

    using (SqlCommand cmd = cn.CreateCommand()) 
    {
      ...
      cmd.Dispose(); 
    

    It looks like a bug.

提交回复
热议问题