SqlCacheDependency.SqlCacheDependency(SqlCommand) Constructor
Assembly: System.Web (in system.web.dll)
public SqlCacheDependency ( SqlCommand sqlCmd )
public function SqlCacheDependency ( sqlCmd : SqlCommand )
Not applicable.
Parameters
- sqlCmd
A SqlCommand that is used to create a SqlCacheDependency object.
| Exception type | Condition |
|---|---|
|
The sqlCmd parameter is a null reference (Nothing in Visual Basic). | |
|
The SqlCommand instance has its NotificationAutoEnlist property set to true and there is an @ OutputCache directive on the page with the SqlDependency attribute set to |
This constructor is used to create SqlCacheDependency objects that use the query-notification feature of SQL Server 2005 products.
SQL statements that are associated with the sqlCmd parameter must include the following:
-
Fully qualified table names, including the name of the table owner. For example, to refer to a table named Customers
that is owned by the database owner, the SQL statement must refer todbo.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 dbo.customers, you must useselect name, address, city, state from dbo.customers.
This constructor cannot be used to associate a SqlCommand instance with a SqlCacheDependency instance on a page using SQL Server 2005 query notifications with page-level output caching.