home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / QuickStart / aspplus / samples / config / config1.aspx < prev    next >
Encoding:
Text File  |  2000-05-30  |  992 b   |  41 lines

  1. <%@ Import Namespace="System.Data" %>
  2. <%@ Import Namespace="System.Data.SQL" %>
  3.  
  4. <html>
  5.  
  6. <script language="C#" runat="server">
  7.  
  8.     void Page_Load(Object Src, EventArgs E ) {
  9.  
  10.         String dsn = (String) ((Hashtable) Context.GetConfig("databases"))["pubs"];
  11.  
  12.         SQLConnection myConnection = new SQLConnection(dsn);
  13.         SQLDataSetCommand myCommand = new SQLDataSetCommand("select * from Authors", myConnection);
  14.  
  15.         DataSet ds = new DataSet();
  16.         myCommand.FillDataSet(ds, "Authors");
  17.  
  18.         MyDataGrid.DataSource=new DataView(ds.Tables[0]);
  19.         MyDataGrid.DataBind();
  20.     }
  21.  
  22. </script>
  23.  
  24. <body>
  25.  
  26.   <h3><font face="Verdana">Retrieving Configuration Data</font></h3>
  27.  
  28.   <ASP:DataGrid id="MyDataGrid" runat="server"
  29.     BackColor="#ccccff" 
  30.     BorderColor="black"
  31.     ShowFooter="false" 
  32.     CellPadding=3 
  33.     CellSpacing="0"
  34.     Font-Name="Verdana"
  35.     Font-Size="8pt"
  36.     HeaderStyle-BackColor="#aaaadd"
  37.   />
  38.  
  39. </body>
  40. </html>
  41.