Why am i not getting any SQL notifications fired?
What are the constraints implementing SQL Server 7/2000 Dependency Caching? (see below...)
Here are few quick things you can check real quick
- Check your query string. Is it valid?
- Be sure you don’t have select *
- Be sure you do have two-part names for the tables e.g., dbo.countries
- Ensure that you have your broker service enabled: Run SET ENABLE_BROKER
- Check the compatibility mode of your database to be set as 90 at the database level. You can see and modify this setting in the Database Properties/Options/Compatibility level. *
- If you are want to use compatiblity mode 80 then you can still achieve it by setting ARITHABORT ON for the database properties or specifying at each individual connection as an example below -
Dim conn As SqlConnection = New SqlConnection(connectionString)
Dim cmd1 As New SqlCommand("SET ARITHABORT ON", conn)
Dim cmd As New SqlCommand("SELECT country, country_desc FROM dbo.COUNTRY", conn)
dep = New SqlDependency(cmd)
AddHandler dep.OnChange, AddressOf TableProxy.OnDependencyChanged
Dim rdr As SqlDataReader
rdr = cmd.ExecuteReader()
There are several constraints as well in the way which query you can use for SQL notifications ....
Don’t use queries whose results will change frequently.
Don’t use Select * in queries.
Do select explicit columns.
Don’t use UNION, DISTINCT, or TOP.
Don’t use Aggregate functions such as AVG, MAX, etc...
Take a detailed peek at the do's and dont's here -
Take a look at ASP.NET’s Visual Web Developer Guided Tour for implementing SQL Server 7/2000 Dependency Caching at -
HTH, Thanks - Dipesh