日期:2014-05-20  浏览次数:20405 次

asp.net2.0开发指南中的缓存示例问题请教
RT,看到第12章有个示例是做缓存示例的,现在有两个文件1、default.aspx   2、web.config
按书上的第一步先在命令窗口里面输入“aspnet_regsql   -S   localhost   -U   sa   -   P   cjy   -d   pubs   -ed   -t   titles   -et”
其中在default.aspx文件中的代码如下
--------------------------------------------
<%@   Page   Language= "C# "   AutoEventWireup= "true "     CodeFile= "Default.aspx.cs "   Inherits= "_Default "   %>
<%@   OutputCache   Duration= "10000 "   SqlDependency= "pubs:titles "   VaryByParam= "none "   %>
<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   runat= "server ">
        <title> 无标题页 </title>
</head>
<body>
        <form   id= "form1 "   runat= "server ">
        <div>
        <fieldset   style= "width:260px; ">
                <legend> SQL数据缓存依赖应用 </legend>
                <br   />
                asdf
                <asp:GridView   ID= "GridView1 "   runat= "server "   AllowPaging= "True "   AutoGenerateColumns= "False "
                        DataSourceID= "SqlDataSource1 "   PageSize= "6 ">
                        <Columns>
                                <asp:BoundField   HeaderText= "ID号 "   DataField= "title_id "   ReadOnly= "true "   SortExpression= "title_id "   />
                                <asp:BoundField   HeaderText= "价格 "   DataField= "price "   SortExpression= "price "   />
                                <asp:BoundField   HeaderText= "Ad "   DataField= "advance "   SortExpression= "advance "   />
                        </Columns>
                </asp:GridView>
                <asp:SqlDataSource   ID= "SqlDataSource1 "   runat= "server "   ConnectionString= " <%$   ConnectionStrings:pubsConnectionString   %> "
                        SelectCommand= "SELECT   [price],   [title_id],   [advance]   FROM   [titles]   where   [type]   =   'business ' "> </asp:SqlDataSource>
                <asp:Label   ID= "Label1 "   runat= "server "   Text= " "> </asp:Label> </fieldset>