Using Access Data on an ASP.NET Web Page
06/21/2009
You can now use the database in a Web page. This part of the walkthrough uses an AccessDataSource control and a DataList control.
To add AccessDataSource and DataList controls to the page
- Open the Default.aspx page (or another page that you want to use) and switch to Design view.
- From the Data group in the toolbox, drag an AccessDataSource control onto the page.
Note If the Access Data Source Tasks menu does not appear, right-click the control and then click Show Smart Tag.
- On the Access Data Source Tasks shortcut menu, click Configure Data Source. The Configure Data Source wizard is displayed.
- On the Choose a database page, in the Microsoft Access Data file box, type ~/App_Data/Northwind.mdb or use the Browse button to select the .mdb file.
- Click Next to open the Configure Select Statement page, and then click Specify columns from a table or view.
- In the Name list, click Categories.
- Select the CategoryName and Description check boxes and then click Next.
- Optionally, click Test Query to test your query.
- Click Finish.
- From the Data group in the toolbox, drag a DataList control onto the page.
- On the DataList Tasks menu, in the Choose Data Source box, click AccessDataSource1.
- Click Ctrl+F5 to run the page with the default layout.
- Close the browser.