May 2002
Beginner
408 pages
9h 10m
English
In Hour 6, you saw how to use the Command object in conjunction with the DataAdapter object to retrieve records from the database and place them into a DataSet. The DataSet was then bound to a Web control such as the DataGrid and displayed in a Web form. The code in Listing 8.1 is a review of the ADO.NET code required to perform these tasks.
<script language="VB" runat="server" > Sub Page_Load(Source as Object, E as EventArgs) Dim conn as New SqlConnection("Initial " + _ Catalog=Northwind;Server=(local);UID=sa;PWD=;") Dim cmd as New SqlCommand("SELECT * FROM Employees", conn) Dim adapt as New SqlDataAdapter(cmd) Dim dsEmployees as New DataSet() conn.Open() adapt.Fill(dsEmployees, ... |
Read now
Unlock full access