核心代码 直接下载
dim strdataname
dim strtablename
dim number
strdataname=request.form("dataname")
strtablename=request.form("tablename")
''连接access数据
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("accessdata\"&strdataname)
''建立fso,准本写xml
set fso=server.createobject("scripting.filesystemobject")
xmlfile=server.mappath("xmldata\data.xml")
fso.createtextfile(xmlfile)
set otf=fso.opentextfile(xmlfile,8)
'开始写xml
otf.writeline("<?xml version='1.0' encoding='gb2312'?>")
otf.writeline("<!-- 生成的xml数据仓库 by (卡卡)caca -->")
otf.writeline("<"&strdataname&">")
set rs=server.createobject("adodb.recordset")
sqlstr="select * from "&strtablename
rs.open sqlstr,conn,1,3
set fld=rs.fields
rs.movefirst
'''''''''获取数据表中列的名称<20'''''''''''''
dim arrclome(30)
for i=0 to fld.count-1
arrclome(i)=rs(i).name
next
while not rs.eof
otf.writeline("<"&strtablename&">")
for i=0 to fld.count-1
otf.writeline("<"&arrclome(i)&">"&rs(arrclome(i))&"</"&arrclome(i)&">")
next
otf.writeline("</"&strtablename&">")
rs.movenext
wend
%>
<%
otf.writeline("</"&strdataname&">")
%>
dim strtablename
dim number
strdataname=request.form("dataname")
strtablename=request.form("tablename")
''连接access数据
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("accessdata\"&strdataname)
''建立fso,准本写xml
set fso=server.createobject("scripting.filesystemobject")
xmlfile=server.mappath("xmldata\data.xml")
fso.createtextfile(xmlfile)
set otf=fso.opentextfile(xmlfile,8)
'开始写xml
otf.writeline("<?xml version='1.0' encoding='gb2312'?>")
otf.writeline("<!-- 生成的xml数据仓库 by (卡卡)caca -->")
otf.writeline("<"&strdataname&">")
set rs=server.createobject("adodb.recordset")
sqlstr="select * from "&strtablename
rs.open sqlstr,conn,1,3
set fld=rs.fields
rs.movefirst
'''''''''获取数据表中列的名称<20'''''''''''''
dim arrclome(30)
for i=0 to fld.count-1
arrclome(i)=rs(i).name
next
while not rs.eof
otf.writeline("<"&strtablename&">")
for i=0 to fld.count-1
otf.writeline("<"&arrclome(i)&">"&rs(arrclome(i))&"</"&arrclome(i)&">")
next
otf.writeline("</"&strtablename&">")
rs.movenext
wend
%>
<%
otf.writeline("</"&strdataname&">")
%>