Active|activex
test.asp
The following is the program code
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<title>activex Component Application Example one </title>
<body>
<%
'---------------------------------------------------------
' ActiveX component application Example One
' Read the authors table in SQL Server 7 pubs database and page to display
' ASP file is responsible for calling and foreground data validation, where the page parameter is mainly
' This example completely uses ActiveX components to complete the function, fast, good confidentiality, but the page customization ability is poor
' JJX by 2000/4/15
'----------------------------------------------------------------
Dim blnerror
If not IsEmpty (Request ("page") Then
If not IsNumeric (Request ("page") Then
Response.Write "Parameter Error! "
Blnerror=true
End If
End If
If not Blnerror then
Dim Objloop
Set objloop=server.createobject ("Performance.loop")
Objloop.list ()
Set objloop=nothing
End If
%>
</body>
VB Loop class file
Create a performance ActiveX DLL project that references the Microsoft Active Server Pages Library and Microsoft ActiveX Databae Object.
Fill in a class named loop
The following is the program code
Option Explicit
Dim Myscriptingcontext as ScriptingContext
Dim Myrequest as Request
Dim Myresponse as Response
Sub OnEndPage ()
Set Myresponse = Nothing
Set myrequest = Nothing
Set Myscriptingcontext = Nothing
End Sub
Sub OnStartPage (Passedscriptingcontext as ScriptingContext)
Set Myscriptingcontext = Passedscriptingcontext
Set myrequest = myscriptingcontext.request
Set Myresponse = Myscriptingcontext.response
End Sub
Function List ()
Dim con as New ADODB. Connection
Dim rs as New ADODB. Recordset
Dim I as Integer
Dim J as Integer
Dim Intpage as Integer
Dim Intpagesize as Integer
Dim Intpagecount as Integer
Dim Strscriptname as String
Dim Intpos as Integer
Dim Intfieldcount as Integer
Strscriptname = Myrequest.servervariables ("Script_name")
Intpos = InStrRev (Strscriptname, "/")
If intpos <> 0 Then
Strscriptname = Mid (strscriptname, intpos + 1)
End If
If IsEmpty (myrequest ("page")) Then
Intpage = 1
Else
Intpage = CInt (myrequest ("page"))
End If
Intpagesize = 10
Con. Open "Provider=SQLOLEDB.1; Persist Security Info=false; User id=sa;initial catalog=pubs;data source= (local)
Rs. Open "SELECT * from authors", Con, adOpenStatic
Intfieldcount = Rs. Fields.Count
With Myresponse
. Write "<table border=1>"
If not (Rs. EOF and Rs. BOF) Then
Rs. PageSize = 10
Rs. AbsolutePage = Intpage
Intpagecount = Rs. PageCount
If intpage > Intpagecount Then
Intpage = Intpagecount
&