Database File calling in ASP development (3)

Source: Internet
Author: User
In the above code, it is called GetSQLRecordset and the file name is ADOSQLFunctions. asp.
Now, you can use this file to call any Access database connection and filter the table records. Take the Friend. mdb file as an example to list all the records in the table data. The program code is as follows:
<HTML> <BODY>
<! -- # Include file = "adovbs. inc" -->
<! -- # Include file = "ADOSQLFunctions. asp" -->
<%
Dim objRS
Set objRS = GetSQLRecordset ("SELECT number, name, gender from _ data", "Friend. mdb", "data ")
Do While Not objRS. EOF
Response. Write "no.:" & objRS ("no.") & "<BR>"
Response. Write "name:" & objRS ("name") & "<BR>"
Response. Write "gender:" & objRS ("gender") & "<BR>"
Loop
ObjRS. Close
Set objRS = Nothing
ObjConn. Close
Set objConn = Nothing
%>
</BODY> </HTML>
Summary
In ASP Programming, good functions can be easily understood for our program code, and the reading structure is easy to maintain. At the same time, a large number of complicated and repetitive codes can be avoided. In the above case, if you just connect to the database, use the first case to set the file ADORecordset. you can install (include) asp. To filter the records of a table in the database or operate other SQL statements, use the second case to set the file ADOSQLRecordset. you can install asp.

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.