<%@ OutputCache Duration="60" VaryByParam="none" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<head>
<H4>Masters Table</H4>
<script language="VB" runat="server">
  Sub Page_Load(Source As Object, E As EventArgs) 
    Dim myConnection As OleDbConnection
    Dim myCommand    As OleDbDataAdapter
    Dim ds           As New DataSet
    Dim ConnStr      As String
    Dim SQL          As String
    '设置连接串
    ConnStr = "Provider=SQLOLEDB; Data Source=(local);"
    ConnStr = ConnStr + " Initial Catalog=ASPNET; User ID=sa"
    myConnection = New OleDbConnection(ConnStr)
    '设置DataSetCommand
    SQL = "select * from Masters"
    myCommand = New OleDbDataAdapter(SQL, myConnection)
    '使用 Fill 方法填充dataset
    myCommand.Fill(ds, "Masters")
    '绑定DataGrid	
    DataGrid1.DataSource=ds.Tables("Masters").DefaultView
    DataGrid1.DataBind()
   '显示创建时间
   TimeMsg.Text = DateTime.Now.ToString()
  End Sub
</script>
</head>
<body style="background-color='beige'; font-family='verdana'; font-size='10pt'">
<form  runat=server>
	 <asp:DataGrid id="DataGrid1" runat="server" /> 
    <i>最后被创建:</i> <asp:label id="TimeMsg" runat="server"/>
</form>
   </body>
</html>
