Data | Database The function name in the above code is: Getsqlrecordset, the file name is adosqlfunctions.asp.
You can now use this file to invoke the connection to any Access database, and to filter the table records. Take the Friend.mdb file as an example, listing all the records in table data, with the program code as follows:
!--#include file= "Adovbs.inc"-->
!--#include file= "adosqlfunctions.asp"-->
<%
Dim objRS
Set objrs=getsqlrecordset ("Select number, name, sex from_ data", "Friend.mdb", "data")
Do as Not objrs.eof
Response.Write "No.:" &objrs ("number") & "
"
Response.Write "Name:" &objrs ("name") & "
"
Response.Write "Sex:" &objrs ("Gender") & "
"
Loop
Objrs.close
Set objrs=nothing
Objconn.close
Set objconn=nothing
%>
Summary
In ASP programming, the use of good functions can often be simple to our program code, read the organization is easy to maintain, but also can avoid a lot of duplication of complex code. Like the above case, if it is simply connected to the database, in the first case, the file Adorecordset.asp installed (include) in it, to filter the records of a table in the database or other SQL statement operations, in the second case, It's OK to put the file adosqlrecordset.asp in.