You can make a simple request:
SELECT is_broker_enabled FROM sys.databases WHERE Name = 'mydatabasename'
Alternatively, you can simply run SqlDependency and block the error you received if it was not enabled, but the first method is simpler and better:
try {
SqlDependency.Start();
} catch (InvalidOperationException ex) {
}
source
share