<%@ 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" >
</asp:GridView>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
后台代码:
protected void Page_Load(object sender, EventArgs e)
{
this.lj();
}
private void lj()
{
DataSet ds=new DataSet();
SqlConnection con = new SqlConnection("server=.;database=DLOcean;uid=sa;pwd=sa");
con.Open();
SqlDataAdapter dar = new SqlDataAdapter();
dar.SelectCommand = new SqlCommand("select ID,CD_ID,AD,DATA from PORE_DATA",con);
dar.Fill(ds, "PORE_DATA");
this.gv1.DataSource = ds.Tables["PORE_DATA"].DefaultView;
this.gv1.DataBind();
con.Close();
}
错误信息:
OutputCache 指令的“DLOcean:PORE_DATA”SqlDependency 属性无效。详细错误信息: 无法在配置中找到“DLOcean”数据库。
<%@ 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" >
</asp:GridView>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
后台代码:
protected void Page_Load(object sender, EventArgs e)
{
this.lj();
}
private void lj()
{
DataSet ds=new DataSet();
SqlConnection con = new SqlConnection("server=.;database=DLOcean;uid=sa;pwd=sa");
con.Open();
SqlDataAdapter dar = new SqlDataAdapter();
dar.SelectCommand = new SqlCommand("select ID,CD_ID,AD,DATA from PORE_DATA",con);
dar.Fill(ds, "PORE_DATA");
this.gv1.DataSource = ds.Tables["PORE_DATA"].DefaultView;
this.gv1.DataBind();
con.Close();
}
错误信息:
OutputCache 指令的“DLOcean:PORE_DATA”SqlDependency 属性无效。详细错误信息: 无法在配置中找到“DLOcean”数据库。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货