最新公告 |
当前位置: 首页 > 新闻与文档 > SonicWall配置 >

asp使用activex组件实例一

时间:2012-07-24 00:10来源:港湾互联网络 作者:港湾网络编辑 点击:
test.asp[code]!doctype html public -//w3c//dtd html 4.0 transitional//en htmlhead titleactivex组件应用例子一/title/head % '--------------------------------------------------------- 'activex组件应用例子一 '读取sql server 7 pubs数据库中autho

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=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>" & rs(i).name & "</th>"

  next

  .write "</tr>"

  

  for i = 1 to intpagesize

  if rs.eof then

  exit for

  end if

  .write "<tr>"

  for j = 0 to intfieldcount - 1

  .write "<td>" & rs(j).value & "</td>"

  next

  

  .write "</tr>"

  rs.movenext

  next

  .write "</table>"

  end with

  

  rs.close

  set rs = nothing

  con.close

  set con = nothing

  end function

  [/code] 

(责任编辑:admin)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
用户名: 验证码: 点击我更换图片
栏目列表
推荐内容
驱白巴布期片 白癜风的发病原因 复方卡力孜然酊 白癜风早期能治愈吗 北京军颐中医医院 白癜风早期能治愈吗 北京军颐中医医院 北京军颐中医医院 补骨脂注射液 白癜风症状 白癜风治疗医院 北京白癜风医院 治疗白癜风最好的方法 北京军颐中医医院 头部白癜风的症状 白癜风传染吗 白癜风的发病原因 北京白癜风医院哪家好 白癜风的危害 白癜风早期症状 白癜风的治疗 白癜风症状 白癜风治疗 专业治疗白癜风医院哪家好 白癜风早期能治愈吗 白癜风症状 白癜风能治愈吗 白癜风治疗 白癜风治疗方法 白癜风怎么治疗 儿童白癜风发病的原因 白癜风的危害 白癜风治疗要花多少钱 白癜风去哪里治疗最好 白癜风治疗医院 如何治疗白癜风好 白癜风能治愈吗 什么方法治疗白癜风好 廊坊治疗白癜风最好的专科医院 白癜风怎么治疗好 白癜风早期能治愈吗 白癜风哪里治疗好 治疗白癜风的偏方有哪些 怎么治疗白癜风好 石家庄白癜风最好的医院 怎么治疗白癜风好 治疗白癜风哪家医院好 治疗牛皮癣,北京牛皮癣医院 白癜风治疗最好医院 白癜风能治愈吗 白癜风能治愈吗 白癜风早期症状 白癜风专科医院 治疗白癜风医院 白癜风早期症状是怎么样 天津治疗白癜风哪家医院效果最好 北京白癜风军颐中医医院 白癜风治疗医院 白癜风如何治疗 白癜风医院 治疗白癜风最好医院 牛皮癣 牛皮癣治疗 牛皮癣医院 治疗白癜风多少钱 北京治疗白癜风最好医院 白癜风早期症状 治疗白癜风偏方
How To Get Rid Of Stretch Marks
How to Get Rid of Acne Scars
how to get rid of flakes
how to ask a girl out
how to get a girl to like you
How To Talk To Girls
How To Impress A Girl