<%LANGUAGE="VBScript"%>
<% ' Set Timeout for large databases and / or slow Servers, default = 90 (seconds) %>
<% Server.ScriptTimeout = 3600 %>
<%
' ###################################
' # Author : Tranzity #
' # Email :
tranzity@forze.nl #
' # Date : 03-04-2002 #
' # Language: ASP/VBScript #
' # Function: DB to XML #
' ###################################
' Define variables
dim wsh, rs
' DB connection
dim Conn
Set Conn = Server.CreateObject("ADODB.Connection")
sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("/mdb-database/database.mdb") & ";" & _
"Persist Security Info=True"
Conn.Open(sConnection)
' Loads the recordset
set rs = conn.Execute("SELECT * FROM esempio ORDER BY ID DESC")
' Open Windows Scripting Shell
set wsh = createobject("WScript.Shell")
' Puts the first XML Lines in the document
wsh.run("cmd /c echo ^<?xml version=""1.0"" encoding=""ISO-8859-1"" ?^> > " & server.mappath("cddatabase.xml"))
wsh.run("cmd /c echo ^<cddatabase^> >> " & server.mappath("cddatabase.xml"))
set wsh = nothing
' Loads the complete database into the XML document (This may take a while)
do until rs.EOF
set wsh = createobject("WScript.Shell")
wsh.run("cmd /c echo ^<item^> >> " & server.mappath("cddatabase.xml"))
wsh.run("cmd /c echo ^<cdid^>" & rs("cdid") & "^</cdid^> >> " & server.mappath("cddatabase.xml"))
wsh.run("cmd /c echo ^<title^>" & rs("title") & "^</title^> >> " & server.mappath("cddatabase.xml"))
wsh.run("cmd /c echo ^</item^> >> " & server.mappath("cddatabase.xml"))
set wsh = nothing
rs.movenext
loop
' Closes the XML Tags
set wsh = createobject("WScript.Shell")
wsh.run("cmd /c echo ^</cddatabase^> >> " & server.mappath("cddatabase.xml"))
set wsh = nothing
' Closes connection
rs.close
Conn.close
%>