asp使用activex组件实例一

2016-01-29 18:06 2 1 收藏

asp使用activex组件实例一,asp使用activex组件实例一

【 tulaoshi.com - ASP 】

  test.asp[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"

  <html<head

  <titleactivex组件应用例子一</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=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

  End If

  

  

  If intPageCount 1 Then

  .Write "<tr<td colspan=" & intFieldCount & ""

  For i = 1 To intPageCount

  If intPage = i Then

  .Write "[" & i & "] "

  Else

  .Write "<a href=" & strScriptName & "?page=" & i & "[" & i & "]</a "

  End If

  Next

  .Write "</td</tr"

  

  

  End If

  End If

  

  .Write "<tr"

  For i = 0 To intFieldCount - 1

  .Write "<th" &

来源:https://www.tulaoshi.com/n/20160129/1504341.html

延伸阅读
标签: ASP
  没有人会在没有必要的情况下采用更加麻烦的方法来工作,除非是没有选择的余地。所以如果我要告诉你有一种简单的技术可以使你的ASP开发更加快速,并且更加高效率,你一定对此特别感兴趣。这一方法将从你的ASP页中的绝大部分business logic转移到一个Visual Basic ActiveX .dll以达到提高整个网页的性能。 使用ActiveX .dll的原因  ...
刚学完VB6高级编程,对于三层架构,类,ActiveX组件等方面的认识还比较模糊, 这个学期的毕业设计是用VB6+SQL Server2000开发一个进销存系统,需要用到的前面所说的知识, 当务之急就是得把前面所学的知识搞明白!希望通过复习,跟此次的毕业设计,能对VB有更深的认识(虽然我的兴趣还是WEB开发)! 另外,前段时间看了一篇讲述三层架构的文章 ,推荐给未曾...
标签: Web开发
本文关键字:教程/ASP/入门     ASP对象让你的服务器和浏览器互相影响,你会例行公事的在你的ASP脚本中使用一个或者多个对象。你不用安装任何东西来使用它们,但是你必须要记住打开或者关闭它们。     ASP组件,和ASP对象不同,它是ActiveX控制和ASP接口让普通进程单一化。一些普通的使用对象和组件就在这个下...
标签: Web开发
ajax.html !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" html xmlns="http://www.w3.org/1999/xhtml" head meta http-equiv="Content-Type" content="text/html; charset=gb2312" / title兼容多浏览器的AJAX入门实例(超详细注释)/title script type="text/ja...
标签: ASP
ASP 组件 FILE对象 当前,基于浏览器/服务器模式的应用比较流行。当用户需要将文件传输到服务器上时,常用方法之一是运行FTP服务器并将每个用户的FTP默认目录设为用户的Web主目录,这样用户就能运行FTP客户程序并上传文件到指定的 Web目录。这就要求用户必须懂得如何使用FTP客户程序。因此,这种解决方案仅对熟悉FTP且富有经验的用...

经验教程

591

收藏

52
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部