<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<HTML>
<HEAD>
<script language="vb" runat="server">
Public Sub Page_Load(Sender As System.Object, E As System.EventArgs)
Dim sConn As New SqlConnection("workstation id=Intranet;packet size=4096;user id=USERID; _
data source=DATABASESERVER;persist security info=True;initial catalog=DATABASE;password=PASSWORD")
Dim myAdapter As SqlDataAdapter = New SqlDataAdapter
myAdapter.TableMappings.Add("Table", "[myTable]")
sConn.Open()
Dim sCmd As New SqlCommand("SELECT myField FROM [myTable]", sConn)
sCmd.CommandType = CommandType.Text
myAdapter.SelectCommand = sCmd
Dim ds As DataSet = New DataSet("[myTable]")
myAdapter.Fill(ds)
dg1.DataSource = ds.Tables(0).DefaultView
Page.DataBind()
End Sub
</script>
</HEAD>
<body>
<asp:DataGrid id="dg1" runat="server" />
</body>
</HTML>