home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / QuickStart / aspplus / samples / cache / outputcache2.aspx < prev    next >
Encoding:
Text File  |  2000-05-30  |  1.2 KB  |  46 lines

  1. <%@ OutputCache Duration="10" %>
  2. <%@ Import Namespace="System.Data" %>
  3. <%@ Import Namespace="System.Data.SQL" %>
  4.  
  5. <html>
  6.  
  7.   <script language="C#" runat="server">
  8.  
  9.       void Page_Load(Object Src, EventArgs E ) {
  10.           
  11.             SQLConnection myConnection = new SQLConnection("server=localhost;uid=sa;pwd=;database=pubs");
  12.             SQLDataSetCommand myCommand = new SQLDataSetCommand("select * from Authors", myConnection);            
  13.                 
  14.             DataSet ds = new DataSet();
  15.             myCommand.FillDataSet(ds, "Authors");
  16.           
  17.             MyDataGrid.DataSource=new DataView(ds.Tables[0]) ;
  18.             MyDataGrid.DataBind();
  19.           
  20.             TimeMsg.Text = DateTime.Now.ToString();
  21.       }
  22.  
  23.   </script>
  24.  
  25.   <body>
  26.   
  27.     <h3><font face="Verdana">Using the Output Cache</font></h3>
  28.  
  29.     <ASP:DataGrid id="MyDataGrid" runat="server"
  30.         Width="700"
  31.         BackColor="#ccccff" 
  32.         BorderColor="black"
  33.         ShowFooter="false" 
  34.         CellPadding="3"
  35.         CellSpacing="0"
  36.         Font-Name="Verdana"
  37.         Font-Size="8pt"
  38.         HeaderStyle-BackColor="#aaaadd"
  39.     />
  40.  
  41.     <p>
  42.     
  43.     <i>Last generated on:</i> <asp:label id="TimeMsg" runat="server" />
  44.  
  45.   </body>
  46. </html>