Datasheet
The data is now in our DataSet so we can use it as the DataSource for the grid, and bind the grid:
DataGrid1.DataSource = ds
DataGrid1.DataBind()
End Sub
This may look like a complex set of procedures, but it's actually a simple set of steps that is used many
times when you need to fetch data. You'll be seeing this many times during this book, and we'll go over
its theory later so you really understand what's happening. For now though, let's look at another
method of saving time, by using Web Matrix code wizards.
Displaying Data Using the Code Wizards
There are times where both the drag and drop from the Data Explorer and the template pages cannot
provide you with exactly what you need. Perhaps you'd like to customize the query, or just add a
routine to fetch data to an already existing page. The code wizards allow you to add code routines to a
page, giving you a finer control of the data being fetched or updated. Let's give this a go.
Try It Out Creating a Data Page
1.
Create a new blank ASP.NET page called CodeWizard.aspx.
2. Switch to Code view and you'll notice that the Toolbox now shows Code Wizards as in
Figure 8-7:
Figure 8-7
265
Reading From Databases
57076_Ch 8 SAN.qxd 01/12/2003 6:43 PM Page 265