I have notification services installed, the broker service is enabled on the database and I have set the BO ReceiveQueryNotifications to True. When I run a form containing the BO I get the error:-
"When using SqlDependency without providing an options value, SqlDependency.Start() must be called prior to execution of a command added to the SqlDependency instance"
I have done nothing in SQL Notification Services itself as I have assumed SF handles this for me. Are there any additional steps I have missed in Notification Services itself?
Thanks in advance,
Aaron
Here is the sample: http://forum.strataframe.net/FindPost16012.aspx
Have I done something wrong?
Thanks
This is a tough question to answer There are a lot of "gotchas" when using Query Notifications. You have to have properly formatted queries with explicit field names, schema names provided for tables, etc.
Last night when I was messing with the sample I chased my tail for a while because I left the dbo off of the Customers table in the query. There are quite a few rules when using the SqlDependency...but I did get it working and that is why I provided the sample and some of my notes to get it to work as SQL Server is very strict when subscribing to a notification.
"SELECT "
Did you have to setup or initialise SQL Notification Services itself other than the ALTER DATABASE xxxxx SET ENABLE_BROKER? My SQL Notification Services was simply installed out of the box with no post configuration beyond the intial setup.
I will be away for a couple of days so thanks in advance.
But back to the point of the matter, to grant a subscription permission to a user you would do this:
GRANT SUBSCRIBE QUERY NOTIFICATIONS TO [sqldependency_user]