ASP uses an ActiveX component instance one

Source: Internet
Author: User
Tags integer
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
&



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.