SqlDependency.Start Method (String, String)
Assembly: System.Data (in system.data.dll)
The connection string for the instance of SQL Server from which to obtain change notifications.
An existing SQL Server Service Broker queue to be used. If null, the default queue is used.
Return Valuetrue if the listener initialized successfully; false if a compatible listener already exists.
The connectionString parameter is NULL.
The connectionString parameter is the same as a previous call to this method, but the parameters are different.
The method was called from within SQLCLR.
The caller does not have the required SqlClientPermission code access security (CAS) permission.
A subsequent call to the method has been made with an equivalent connectionString parameter but a different user, or a user that does not default to the same schema.
Also, any underlying SqlClient exceptions.
This method starts the listener for the AppDomain for receiving dependency notifications from the instance of SQL Server specified by the connectionString parameter. This method may be called more than once with different connection strings for multiple servers.
If no queue name is specified, SqlDependency creates a temporary queue and service in the server that is used for the entire process, even if the process involves more than one AppDomain. The queue and service are automatically removed upon application shutdown.
Multiple calls to the Start method can be made, subject to the following restrictions:
Multiple calls with identical parameters (the same connection string, queue, and Windows credentials in the calling thread) are valid.
Multiple calls with different connection strings are valid as long as:
Each connection string specifies a different database, or
Each connection string specifies a different user, or
The calls come from different application domains.
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter EditionThe Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.