<%@ Page Language="C#" %>
<script runat="server">
protected void dataSelect(object sender, SqlDataSourceSelectingEventArgs e)
{
lblMessage.Text = "Retrieving data from database";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Cache SqlDataSource</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label
id="lblMessage"
EnableViewState="false"
Runat="server" />
<br /><br />
<asp:GridView
id="grdEmployee"
DataSourceID="srcEmployee"
Runat="server" />
<asp:SqlDataSource
id="srcEmployee"
EnableCaching="True"
CacheDuration="3600"
SelectCommand="SELECT * FROM Employee"
ConnectionString="Data Source=whsql-v08.prod.mesa1.secureserver.net;Initial Catalog=DB_49907;User ID=java2suser;Password='password';"
Runat="server"
OnSelecting="dataSelect" />
</div>
</form>
</body>
</html>
<%-- server=localhost;Initial Catalog=TT;User Id=sa;Password=yourpassword; --%>
|