ASP. NET-how to: Use the accessdatasource control to connect to the Access Database

Source: Internet
Author: User
Tags microsoft access database

 

1. Open the page for connecting to the access database.

2. Switch to the design view.

3. Drag the accessdatasource control from the "data" group in the toolbox to the page.

4. If the "Smart Tag" panel is not displayed, right-click the control and click "show Smart Tag ".

5. In the "accessdatasource task" list, click "configure data source ". The "configure data source" Wizard is displayed.

6. In the select database pane, type or select the Microsoft Access database path. The database extension is. MDB.

Note: We recommend that you store the ACCESS database in the app_data folder of the website, so that the Web server does not return the. MDB file to respond to Web requests. In addition, for local websites, visual web developer can ensure that the Web server has the right to read and write files in the app_data folder. For websites on other computers, you need to manually set these permissions.

7. Click "Next ".

8. In the "Configure select statements" pane, if you want to use the Wizard to create an SQL query, click "specify columns from tables or views ", use the options in this pane to configure the query.

Note: to allow the Wizard to generate insert, update, and delete statements based on the SELECT statement you have created, click "advanced ".

9. If you want to use the Query Builder or compile a SELECT query, click "specify a custom SQL statement or stored procedure", click "Next", and then write an SQL statement. Click "Update", "insert", or "delete" to create these update statements.

10. Click "Next ".

11. In the test query pane, click test query to determine whether to return the expected results.

12. Click Finish ".

13. You can now bind a Data Control (such as the gridview Control) to the accessdatasource control.

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.