Menu
  • HOME
  • TAGS

SqlDependency fire correctly, but also at start time

c#,sql-server,sql-server-2008,notifications,sqldependency

To fix this issue, you need only to set the notification for that SqlCommand to null. cmd.Notification = null; Just try this and i think your problem will be resolved. Enter this line before starting the dependency using the SqlWatcher class...

SqlDependancy is firing more times

sql,asp.net,signalr,sqldependency

You are creating new SQLDependency on each page load (refresh). I bet there is correlation between number of page reloads and number of notifications page is receiving via SignalR. Register your notification only once per app lifetime......

Alternative for sqldependency

c#,signalr,sqldependency

I think you can still use SqlDependency if you think a bit more about your actual requirements. The query you're using to detect changes doesn't have to be the same you use to fetch the changes. So you could have select id from chat where chatRoomId = 123 as the...

SqlDependency is working with one but not with other table

c#,sql-server,database-connection,sqldependency

I've repeated your situation and wrote unit test (TwoTablesNotificationTest), but didn't find anything. It works fine for me. In this situation you could stop receive notifications from SqlDependency in case of destructor call of some DatabaseChangeAlert entity, because it has SqlDependency.Stop(connectionString) instruction. Thus, you have to call SqlDependency.Start after every...

sql dependency Invalid object name '

c#,.net,sqldependency

Try specifying a queue name instead of a query, or even without queue. An example can be found on the reference page: https://msdn.microsoft.com/en-us/library/62xk7953%28v=vs.110%29.aspx...

SignalR and SqlDependency refreshment issue - ASP.NET

asp.net,webforms,signalr,sqldependency

I got it, although I don't like this way absolutely, I have declared a static member in the Global.asax file and in the Page_Load event I checked its value, if it was true don't run a new instance of SqlDependency, otherwise run it. if (!Global.PageIsFired) { Global.PageIsFired = true; SqlDependency.Stop(ConfigurationManager.ConnectionStrings["db"].ConnectionString);...

SqlDependency doesn't fire/trigger event

c#,sql-server,sql-server-2008,notifications,sqldependency

Try this: void OnDependencyChange(object sender, SqlNotificationEventArgs e) { // Handle the event (for example, invalidate this cache entry). MessageBox.Show("ikjkjkj"); Debug.WriteLine("fkldjkfjklgjf"); SqlDependency dependency = (SqlDependency)sender; dependency.OnChange -= OnDependencyChange; SomeMethod(); //re-register } Modify SomeMethod(): SqlConnection connection; SqlCommand command; <-- make command instance var void SomeMethod() { // Assume connection is an open...

SignalR MVC4 Issue

javascript,asp.net-mvc-4,signalr,signalr-hub,sqldependency

Make sure you have placed all your script tags from the view inside the scripts section of the view: @section scripts { ... your <script> tags come here } The reason why your alerts don't work is because you have directly put them inside the body of the view which...

Init SqlDependency and notify changes

sql-server-2008,notifications,messaging,service-broker,sqldependency

but it is fired only in the init phase It fires because your query notification subscription is invalid. You must inspect the SqlNotificationEventArgs members. Only the Change type is a notification for change, you are probably getting a Subscribe type with Statement source. Your query does not meet the...

Notify winforms application by Sql Server database changes

c#,.net,sql-server,winforms,sqldependency

There's quite a few limitations with SqlDependency. To quote one relevant issue: The projected columns in the SELECT statement must be explicitly stated, and table names must be qualified with two-part names.Notice that this means that all tables referenced in the statement must be in the same database. (see https://msdn.microsoft.com/library/ms181122.aspx...

NHibernate SysCache2 - dependency breaks cache

c#,sql,nhibernate,sqldependency,syscache2

The solution consisted of solving multiple problems: IntProp was nullable on the table, and property was not nullable int. This led to NHibernate not being able to set NULLs when getting a row, so the property value became 0. When session flushed, it saw a modification (NULL to 0) and...