IIS5 + ADO 2.5新先睹为快技术(一)

4/20/2000来源:ASP技巧人气:23216

  在IIS5(就是安装了Win2000)中自带了新的ADO 2.5版本尤其
增加了对xml技术的支持,并且带入了许多崭新的技术,这些技术可以
帮助我们实现以前必须要依靠组件或者其它技术才能够实现的功能。
我这里做一个简单的介绍让大家对这个新的Web组合有所了解。
从这可以看出,学习和掌握XML技术已经迫在眉睫了。欢迎大家到隔壁
的XML学习园地作客。。。
  新技术之一:
  ADO中新增加了一个Record对象(别和RecordSet对象混淆了)。。。
  它可以操纵服务器上的任何文件。。。
  下面是它运用的事例:

<%
Dim recRoot
Dim rsFiles

Set recRoot = Server.CreateObject("ADODB.Record")

'注意打开的URL必须是运行IIS5中或者支持WebDAV服务,
'至于什么是WebDAV请到隔壁去看看把
recRoot.open "", "URL=http://localhost/iis", adModeRead
Response.Write "<UL>" & Chr(13) & Chr(10)
TraverseTree recRoot
Response.Write "</ul>" & Chr(13) & Chr(10)
recRoot.Close
set recRoot = Nothing

Sub TraverseTree(recNode)

Dim rsChildren
Dim recChildNode
Set recChildNode = Server.CreateObject("ADODB.Record")

Response.Write "<LI>" & recNode("RESOURCE_PARSENAME") & Chr(13) & Chr(10)
Set rsChildren = recNode.GetChildren

If Not rsChildren.EOF Then
Response.Write "<UL>" & Chr(13) & Chr(10)
While Not rsChildren.EOF
If rsChildren("RESOURCE_ISCOLLECTION") Then
recChildNode.Open rsChildren
TraverseTree recChildNode
recChildNode.Close
Else
Response.Write "<LI>" & rsChildren("RESOURCE_PARSENAME") & Chr(13) & Chr(10)
End If
rsChildren.MoveNext
Wend
Response.Write "</UL>" & Chr(13) & Chr(10)
End If
rsChildren.Close
Set rsChildren = Nothing
Set recChildNode = Nothing
End Sub
%>

考虑到很多人目前没有安装Win2000,所以我把运行结果也给出来了,
大家可以看到代码运行的结果。。。
注意要想得到正确的结果必须要让iis目录可以Directory Browing
<UL>
<LI>iis
<UL>
<LI>sdk
<UL>
<LI>admin
<UL>
<LI>mkwebsrv.vbs
<LI>mkwebsrv.js
<LI>metabackrest.vbs
<LI>metabackrest.js
<LI>metaback.vbs
<LI>metaback.js
<LI>logenum.vbs
<LI>logenum.js
</UL>
<LI>asp
<UL>
<LI>applications
<UL>
<LI>session_VBScript.asp
<LI>Session_Jscript.asp
<LI>Application_VBScript.asp
<LI>Application_Jscript.asp
</UL>
<LI>components
<UL>
<LI>redirect.asp
<LI>nts_iis.gif
<LI>ie.gif
<LI>clientcap.htm
<LI>BrowserCap_VBScript.asp
<LI>BrowserCap_Jscript.asp
<LI>AdRotator_VBScript.asp
<LI>AdRotator_Jscript.asp
<LI>adrot.txt
</UL>
<LI>database
<UL>
<LI>Update_VBScript.asp
<LI>Update_Jscript.asp
<LI>StoredPRocedures_VBScript.asp
<LI>StoredProcedures_Jscript.asp
<LI>SimpleQuery_VBScript.asp
<LI>SimpleQuery_Jscript.asp
<LI>MultiScrolling_VBScript.asp
<LI>MultiScrolling_Jscript.asp
<LI>LimitRows_VBScript.asp
<LI>LimitRows_Jscript.asp
<LI>Authors.mdb
<LI>AddDelete_VBScript.asp
<LI>AddDelete_Jscript.asp
</UL>
<LI>docs
<UL>
<LI>toolbar.asp
<LI>sampfram.asp
<LI>libcodebrws.inc
<LI>ColorPicker.asp
<LI>CodeBrws.asp
</UL>
<LI>interaction
<UL>
<LI>ServerVariables_VBScript.asp
<LI>ServerVariables_Jscript.asp
<LI>Redirect_VBScript.asp
<LI>Redirect_Jscript.asp
<LI>QueryString_VBScript.asp
<LI>QueryString_Jscript.asp
<LI>PopulateForm_VBScript.asp
<LI>PopulateForm_Jscript.asp
<LI>Pics_VBScript.asp
<LI>Pics_Jscript.asp
<LI>Logon_VBScript.asp
<LI>Logon_Jscript.asp
<LI>Form_VBScript.asp
<LI>Form_Jscript.asp
<LI>FileList.txt
<LI>Expire_VBScript.asp
<LI>Expire_Jscript.asp
<LI>Cookie_VBScript.asp
<LI>Cookie_Jscript.asp
<LI>ClientScript_VBScript.asp
<LI>ClientScript_Jscript.asp
</UL>
<LI>simple
<UL>
<LI>Variables_VBScript.asp
<LI>Variables_Jscript.asp
<LI>Looping_VBScript.asp
<LI>Looping_Jscript.asp
<LI>Includes_VBScript.asp
<LI>Includes_Jscript.asp
<LI>HeaderInfo.asp
<LI>Functions_VBScript.asp
<LI>Functions_Jscript.asp
<LI>Conditional_VBScript.asp
<LI>Conditional_Jscript.asp
<LI>Arrays_VBScript.asp
<LI>Arrays_Jscript.asp
</UL>
<LI>transactional
<UL>
<LI>SimpleTransaction_VBScript.asp
<LI>SimpleTransaction_Jscript.asp
<LI>FundTransfer_VBScript.asp
</UL>
</UL>
</UL>
<LI>homepage
<UL>
<LI>themes
<UL>
<LI>gunmetal
<UL>
<LI>setup.inc
<LI>layout.inc
<LI>layout.CSS
<LI>gradient.gif
</UL>
<LI>journal
<UL>
<LI>setup.inc
<LI>rip3.gif
<LI>rip2_2.gif
<LI>layout.inc
<LI>layout.css
</UL>
<LI>looseleaf
<UL>
<LI>setup.inc
<LI>layout.inc
<LI>layout.css
</UL>
</UL>
<LI>themes.inc
<LI>theme.inc
<LI>sub.inc
<LI>signbook.asp
<LI>myfiles.asp
<LI>guestbk.asp
<LI>global.asa
<LI>file.gif
<LI>default.asp
<LI>bullet.gif
</UL>
<LI>global.asa
</UL>
</ul>