<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.OleDb" %>
<html>
<head>
<H4>Masters 表</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); Initial Catalog=ASPNET; User ID=sa"
    myConnection = New OleDbConnection(ConnStr)
    
    '设置DataSetCommand
    SQL = "select * from Masters"
    myCommand = New OleDbDataAdapter(SQL, myConnection)

    '使用DataSetCommand的Fill方法填充DataSet
    myCommand.Fill(ds, "Masters")

    '绑定一个DataGrid	
    DataGrid1.DataSource=ds.Tables("Masters").DefaultView
    DataGrid1.DataBind()

  End Sub
</script>
</head>
<body>
<form  runat=server>
	 <asp:DataGrid id="DataGrid1" runat="server" /> 
</form>
</body>
</html>
