我根据一本书上的做法用以下方法使用Sql Server 2005 基于通知的缓存失效
<%@ OutputCache Duration ="99999" SqlDependency="CommandNotification" VaryByParam="none"%>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" CacheDuration="Infinite" CacheExpirationPolicy="Sliding"
ConnectionString="<%$ ConnectionStrings:教务ConnectionString3 %>" EnableCaching="True"
SelectCommand="SELECT [年级], [类别], [学号], [姓名] FROM [dbo.新生]" SqlCacheDependency="CommandNotification"></asp:SqlDataSource>
但却提示以下错误:
该页已在 OutputCache 指令中指定了“SqlDependency="CommandNotification"”属性。在这样的页中,使用 SqlCommand 对象创建 SqlCacheDependency 对象是错误的。
这是为什么?