<!-- #include file="adovbs.inc" -->
<%
' 删除已经存在的文件
dim objfso
set objfso = server.createobject("scripting.filesystemobject")
if objfso.fileexists(server.mappath("db_xml.xml")) then
objfso.deletefile server.mappath("db_xml.xml")
end if
set objfso = nothing
' 定义变量,很好的习惯
dim cnnxml ' ado 连接
dim rstxml ' ado 记录集
set cnnxml = server.createobject("adodb.connection")
cnnxml.open "provider=sqloledb;data source=10.2.1.214;" _
& "initial catalog=samples;user id=samples;password=password;" _
& "connect timeout=15.network library=dbmssocn;"
set rstxml = server.createobject("adodb.recordset")
set rstxml = cnnxml.execute("select * from scratch order by id;")
response.write "<p>saving data as xml...</p>" & vbcrlf
' 保存xml各式的文件.
rstxml.save server.mappath("db_xml.xml"), adpersistxml
' 关闭数据库连接,释放对象
rstxml.close
set rstxml = nothing
cnnxml.close
set cnnxml = nothing
response.write "<p>xml file written...</p>" & vbcrlf
response.write "<p>click <a href=""db_xml.xml"">here</a> to view the file.</p>" & vbcrlf
%>
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器