<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ OutputCache Duration="1000" SqlDependency="DLOcean:PORE_DATA" VaryByParam="none" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<table>
<tr>
<td>
<asp:Label ID="lbl1" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:GridView ID="gv1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1" >
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="CD_ID" HeaderText="CD_ID" SortExpression="CD_ID" />
<asp:BoundField DataField="AD" HeaderText="AD" SortExpression="AD" />
<asp:BoundField DataField="DATA" HeaderText="DATA" SortExpression="DATA" />
<asp:BoundField DataField="CLSJ" HeaderText="CLSJ" SortExpression="CLSJ" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DLOceanConnectionString %>"
SelectCommand="SELECT [ID], [CD_ID], [AD], [DATA], [CLSJ] FROM [PORE_DATA]" SqlCacheDependency="DLOcean:PORE_DATA" EnableCaching="True">
</asp:SqlDataSource>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>sqldatasource里面的:<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DLOceanConnectionString %>"
SelectCommand="SELECT [ID], [CD_ID], [AD], [DATA], [CLSJ] FROM [PORE_DATA]" SqlCacheDependency="DLOcean:PORE_DATA" EnableCaching="True">
</asp:SqlDataSource>
和<%@ OutputCache Duration="1000" SqlDependency="DLOcean:PORE_DATA" VaryByParam="none" %>
里面的SqlDependency都是设置数据库和表名字的。SqlDependency="DLOcean:PORE_DATA"可为什么运行后总是说找不到数据库呢?我用的是sql2005设置数据缓存不用webconfig的,问题究竟出现在哪里呢?
<%@ OutputCache Duration="1000" SqlDependency="DLOcean:PORE_DATA" VaryByParam="none" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>
<table>
<tr>
<td>
<asp:Label ID="lbl1" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:GridView ID="gv1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1" >
<Columns>
<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="CD_ID" HeaderText="CD_ID" SortExpression="CD_ID" />
<asp:BoundField DataField="AD" HeaderText="AD" SortExpression="AD" />
<asp:BoundField DataField="DATA" HeaderText="DATA" SortExpression="DATA" />
<asp:BoundField DataField="CLSJ" HeaderText="CLSJ" SortExpression="CLSJ" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DLOceanConnectionString %>"
SelectCommand="SELECT [ID], [CD_ID], [AD], [DATA], [CLSJ] FROM [PORE_DATA]" SqlCacheDependency="DLOcean:PORE_DATA" EnableCaching="True">
</asp:SqlDataSource>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>sqldatasource里面的:<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DLOceanConnectionString %>"
SelectCommand="SELECT [ID], [CD_ID], [AD], [DATA], [CLSJ] FROM [PORE_DATA]" SqlCacheDependency="DLOcean:PORE_DATA" EnableCaching="True">
</asp:SqlDataSource>
和<%@ OutputCache Duration="1000" SqlDependency="DLOcean:PORE_DATA" VaryByParam="none" %>
里面的SqlDependency都是设置数据库和表名字的。SqlDependency="DLOcean:PORE_DATA"可为什么运行后总是说找不到数据库呢?我用的是sql2005设置数据缓存不用webconfig的,问题究竟出现在哪里呢?
="<%$ ConnectionStrings:DLOceanConnectionString %>"
webconfig里连接数据库的字符串???