当前位置: 首页 > 图文教程 > 网络编程 > ASP > asp使用activex组件实例一

ASP
论坛树状记录表的堆栈展开
Oracle大文本在ASP中存取问题的解决
ASP创建SQL Server数据库的两种方法
浅谈session_onend的调试
用ASP访问数据库的几种常见方式
教你一次下载网页中的所有资源
20种看asp源码的方法及工具
在ASP中使用智岛网格控件全过程
解决使用ASP无法连接ORACLE 9i数据库的问题
用Js判断输入的时间是否有效
ADO数据与XML数据间的转换的类
使用命名管道访问SQL Server
网页加速之网页结构篇
在红蜻蜓中实现多房间
在ASP中使用Oracle数据库技巧
关于分页办法
在VB中使用API函数(Any)
网站ASP漏洞小总结
网页之定时器详解
实用函数- 判断输入的是否是电话号码

ASP 中的 asp使用activex组件实例一


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 41 ::
收藏到网摘: n/a

      
  
    test.asp[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  
    <html><head>
  
    <title>activex组件应用例子一</title></head>
  
  <%
  '---------------------------------------------------------
  'activex组件应用例子一
  '读取sql server 7 pubs数据库中authors表并分页显示
  'asp文件中负责调用并前台数据检验,这里主要指page参数
  '该例子完全使用activex组件来完成功能,速度快,保密性好,但页面定制能力差
  'jjx by 2000/4/15
  '----------------------------------------------------------------
  
  dim blnErrorif not isempty(request("page")) then
  
    if not isnumeric(request("page")) then
  
    response.write "参数错误!"
  
    blnError=true
  
    end ifend ifif not blnError then
  
    dim objLoop
  
    Set objLoop=Server.CreateObject("Performance.Loop")
  
    objLoop.List()
  
    Set objLoop=Nothingend if%>
  
    </body></html>[/code]vb loop class file创建一个performance activex dll项目,引用microsoft active server pages library和Microsoft ActiveX Databae Object。
  
    填加一个class,命名为loop[code]Option Explicit
  
    Dim MyScriptingContext As ScriptingContextDim MyRequest As RequestDim 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=Fal