sqldependency

SQLDependency + Service Broker

╄→尐↘猪︶ㄣ 提交于 2019-12-10 17:55:54
问题 I'm using SqlDependency to get notification when data in some table are changed. private void subscribeBroker() { using (var conn = new SqlConnection(connString)) { conn.Open(); var cmd = new SqlCommand("SELECT text FROM dbo.Test"); cmd.Connection = conn; var dependency = new SqlDependency(cmd); dependency.OnChange += dependency_OnChange; SqlDependency.Start(connString); cmd.ExecuteNonQuery(); } } void dependency_OnChange(object sender, SqlNotificationEventArgs e) { //Do something...

SqlDependency vs constant polling of a SQL Server database

最后都变了- 提交于 2019-12-07 22:41:11
问题 I am currently working on an email application where I have to monitor the table for any new record inserts and send email notification for each row. Right now the changes (inserts) will be at low rate but eventually it will become more. Initially I was thinking about using a SQL Server job to query every 3-5 mins and then I looked into the SqlDependency but I am not sure whether SQL dependency / query notification will be the correct option for my requirement. If there's an insert every

SqlDependency causes error in other application

拟墨画扇 提交于 2019-12-06 14:50:10
问题 I have a project where I need to monitor changes in a 3rd party database. SqlDependency seem like a good solution but it causes the following error in the 3rd party application. INSERT failed because the following SET options have incorrect settings: 'ANSI_NULLS, QUOTED_IDENTIFIER, ANSI_PADDING'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or filtered indexes and/or query notifications and/or XML data type methods and/or spatial index

How efficient SqlDependency (Service Broker) is compared to query by timer?

心已入冬 提交于 2019-12-06 13:47:39
I need to notify users (around 100 clients) of my software (C#, .NET 3.5) when there are new records added in one of the tables of my database (SQL Server 2008). If I understand it right, such operation should qualify as cache invalidation which is exactly what is SqlDependency for, please correct me on this one if I'm wrong. For that I can see 2 options: SqlDependency which will allow me to receive practically realtime notifications. Checking table by some timer. But I never used SqlDependency before and have no idea how reliable is it really? I mean, can I allow my application just run

Service Broker messages start to get hung up after about a day

强颜欢笑 提交于 2019-12-06 02:47:24
问题 I have an application that is using the Service Broker is SQL 2008. About once a day the database's performance starts take a noticeable hit and I have determined that this is because of the Service Broker. If I hard reset all broker connections using the following commands: ALTER DATABASE [RegencyEnterprise] SET OFFLINE WITH ROLLBACK IMMEDIATE ALTER DATABASE [RegencyEnterprise] SET ONLINE Then the performance returns to normal until about the next day. I have also noticed that when

SQL Dependency on SQL Server 2008 Express

一曲冷凌霜 提交于 2019-12-05 04:07:01
问题 I have an application which successfully uses SqlDependency with SQL Server 2008 Standard Edition. But if I switch the connection string to SQL Server 2008 express (with enabled Broker) it stops working. I'm not sure whether it is SQL Server Express specific, but which steps should I follow to find out the reason of the problem? Update. By "stops working" I mean notifications are not raised by SqlDependency 回答1: To understand how SQL Dependency works I recommend you read The Mysterious

SqlDependency subscription not dropped from dm_qn_subscriptions on shutdown

点点圈 提交于 2019-12-04 14:38:38
问题 My SqlDependency works fine, and the Broker Queue and Service get dropped properly when the application exists (I do execute SqlDependency.Stop(...) as recommended before terminating the process), yet I notice that the notification subscription created by the SqlDependency lives on in the table "sys.dm_qn_subscriptions" after the application shuts down. If I later (post-app shutdown) execute the condition that ought to make this subscription fire, it does seem to fire, as SQL Server logs an

Issue of multiple SQL notifications in ASP.Net web application on page refresh

烈酒焚心 提交于 2019-12-04 12:22:30
问题 I am facing an issue while using SQL Server Notifications. I am developing a web application in ASP.net where one of the page needs to be notified about new entries in one of the tables in a SQL Server database. I am using SQL Server Notification services along with Signal R to achieve this functionality.All seems to work fine with my web page getting updates about new data entries. The problem arises when the page using notification is refreshed. I find the no of notification for single

Service Broker messages start to get hung up after about a day

爱⌒轻易说出口 提交于 2019-12-04 07:36:00
I have an application that is using the Service Broker is SQL 2008. About once a day the database's performance starts take a noticeable hit and I have determined that this is because of the Service Broker. If I hard reset all broker connections using the following commands: ALTER DATABASE [RegencyEnterprise] SET OFFLINE WITH ROLLBACK IMMEDIATE ALTER DATABASE [RegencyEnterprise] SET ONLINE Then the performance returns to normal until about the next day. I have also noticed that when performance is poor, running the following query returns a large number (around 1000 currently) of conversations

SqlDependency issue with the asp.net

情到浓时终转凉″ 提交于 2019-12-04 03:17:52
问题 I am trying get the changed values from the sqlserver using the server_broker feature. my code is like below protected void Page_Load(object sender, EventArgs e) { GetData2(); } private void GetData2() { List<Masa> lst = new List<Masa>(); using (SqlConnection con = Baglan.Sql) { string sql = "SELECT [Id],[Ad],[Durum] FROM [dbo].[Masa]"; using (SqlCommand cmd = new SqlCommand(sql, con)) { con.Open(); SqlDependency dependency = new SqlDependency(cmd); dependency.OnChange += new