Constructor SqlCacheDependency
SqlCacheDependency(String, String)
Initializes a new instance of the SqlCacheDependency class, using the supplied connection string and query string.
Declaration
public SqlCacheDependency(string connectionString, string cmdText)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | Connection string to be used by the dependency. |
System.String | cmdText | SQL statement, table name or stored procedure to execute at the data source. |
Remarks
This constructor is used to create SqlCacheDependency objects that use the query-notification feature of SQL Server 2005 products.
SQL query must include the following:
SqlCacheDependency(String, String, SqlCommandType, Dictionary<String, SqlCmdParams>)
Initializes a new instance of the SqlCacheDependency class. It supports the use of 'Stored Procedures'.
Declaration
public SqlCacheDependency(string connectionString, string cmdText, SqlCommandType cmdType, Dictionary<string, SqlCmdParams> cmdParams)
Parameters
Type | Name | Description |
---|---|---|
System.String | connectionString | Connection string to be used by the dependency. |
System.String | cmdText | SQL statement, table name or stored procedure to execute on the data source. |
SqlCommandType | cmdType | The type of the command (text/stored procedure). |
System.Collections.Generic.Dictionary<System.String, SqlCmdParams> | cmdParams | Parameters to be passed to the command. |
Remarks
This constructor is used to create SqlCacheDependency objects that use the query-notification feature of SQL Server 2005 products.
SQL query must include the following:
- Fully qualified table names, including the name of the table owner. For example, to refer to a table called "customers" that is owned by the database owner, the SQL statement must refer to "dbo.customers".
- Explicit column names in the Select statement. You cannot use the asterisk (*) wildcard character to select all columns from a table. For example, instead of "select * from customers", you must use "select name, address, city, state from dbo.customers".