Tuesday, July 21, 2015

SqlDependency Infinite Loop

I recently needed my C# application to invoke some code if there are changes done in a SQL Table. I researched and came across this article 

This article shows how you can use a SQLDependency class to achieve the same.
However I had one issue that my application was running into an infinite loop in the methods that invoked the SQLDependency. To resolve the same i had to simply prefix my table in the schema name and remove TOP clause from my sql query.

Do read https://msdn.microsoft.com/en-us/library/ms181122.aspx if your application is executing your code in an infinite loop.

I would suggest placing a breakpoint on the code where you register dependency since you may not be able to know that the code is actually executing in a loop otherwise.


No comments:

Post a Comment