Datasheet
of products, with a drop-down list showing the product categories. The user could select a category so
that only those categories are shown.
The
Parameters collection contains a Parameter object for each parameter in the query. Thus, a
command with three parameters would have objects looking like in Figure 8-19:
Figure 8-19
Let's look at an example to see how this works.
Try It Out Using Parameters
1.
Create a new blank ASP.NET page called Parameters.aspx.
2. Add a Label and change the Text property to Category:.
3. Add a DropDownList next to the label and change the ID property to lstCategory.
4. Add a Button next to the DropDownList and change the Text property to Fetch.
5. Add a DataGrid underneath the other controls. Your page should now look like Figure 8-20:
Figure 8-20
273
Reading from Databases
57084_08.qxp 30/01/2004 8:03 PM Page 273