Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SqlCacheDependency Constructor (SqlCommand)

Initializes a new instance of the SqlCacheDependency class, using the supplied SqlCommand to create a cache-key dependency.

Namespace:  System.Web.Caching
Assembly:  System.Web (in System.Web.dll)
public SqlCacheDependency(
	SqlCommand sqlCmd
)

Parameters

sqlCmd
Type: System.Data.SqlClient.SqlCommand
A SqlCommand that is used to create a SqlCacheDependency object.
ExceptionCondition
ArgumentNullException

The sqlCmd parameter is null.

HttpException

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 CommandNotification.

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 Customersthat 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 dbo.customers, you must use select 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.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.