Use ASP to query Access Database code

Source: Internet
Author: User
Below is the connection between ASP and access Code ~

========================================================== ======================================

ASP and Access database connection:

<% @ Language = vbs certificate %>
<%
Dim Conn, mdbfile
Mdbfile = server. mappath ("database name. mdb ")
Set conn = server. Createobject ("ADODB. Connection ")
Conn. Open "driver = {Microsoft Access Driver (*. mdb)}; uid = admin; Pwd = Database Password; DBQ =" & mdbfile
%>

========================================================== ======================================

In your example, replace conn with "database name ~

The above is the database connection code; by the way, the code for data operations after the connection:

========================================================== ======================================

1. Create a record set object:

Set rs = server. Createobject ("ADODB. recordset ")
Rs. Open SQL statement, Conn, *, * (here two parameters ~)

2. Method of record set object:

Rs. movenext moves the record pointer down a row from the current position
Rs. moveprevious transfers the record pointer from the current position up a row
Rs. movefirst moves the record pointer to the first row of the data table
Rs. movelast moves the record pointer to the last row of the data table
Rs. absoluteposition = n move the record pointer to the nth row of the data table
Rs. absolutepage = n move the record pointer to the first row of page n
Rs. pagesize = N set N records per page
Rs. pagecount returns the total number of pages based on pagesize Settings
Rs. recordcount total number of returned records
Rs. whether the BOF return record pointer exceeds the first end of the data table. True indicates yes, and false indicates no
Rs. EOF indicates whether the returned record pointer exceeds the end Of the data table. True indicates yes, and false indicates no
Rs. delete deletes the current record, but the record pointer does not move down
Rs. addnew add records to the end of the data table
Rs. update a data table record

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.