方法一:使用轮流查询机制:
<%@ OutputCache Duration="30" VaryByParam="none" SqlDependency="TB:student" %>
webconfig:
<caching>
<sqlCacheDependency enabled="true">
<databases>
<add name="TB" connectionStringName="TbString" pollTime="500"/>
</databases>
</sqlCacheDependency>
</caching>
方法二:SqlServer 2005通知机制:
<%@ OutputCache Duration="30" VaryByParam="none" SqlDependency="CommandNotification" %>
页面后台:
protected void Page_Load(object sender, EventArgs e)
{
SqlDependency.Start(ConfigurationManager.ConnectionStrings["TbString"].ConnectionString);
}