XML连接ACCeSS数据库? ASP问题?急急...
求一个XML文件连接数据库的代码,最好ACCESS的。还要写如何获取数据库记录!谢谢各位拉。<artworkinfo><albuminfo><artLocation>im...
求一个XML文件连接数据库的代码,
最好ACCESS的。还要写如何获取数据库记录!谢谢各位拉。
<artworkinfo>
<albuminfo>
<artLocation>images/album1.jpg</artLocation>
<artist>The Doors</artist>
<albumName>Greatest Hits</albumName>
<artistLink>http://www.zcool.com.cn</artistLink>
<albumLink>http://www.zcool.com.cn</albumLink>
</albuminfo>
</artworkinfo>
帮我看看怎么从数据库读取记录在里面!
还有。 <artLocation>images/album1.jpg</artLocation>
<artist>The Doors</artist>
<albumName>Greatest Hits</albumName>
<artistLink>http://www.zcool.com.cn</artistLink>
<albumLink>http://www.zcool.com.cn</albumLink>
这个部分的内容我要循环读取就想ASP一样。能实现吗? 展开
最好ACCESS的。还要写如何获取数据库记录!谢谢各位拉。
<artworkinfo>
<albuminfo>
<artLocation>images/album1.jpg</artLocation>
<artist>The Doors</artist>
<albumName>Greatest Hits</albumName>
<artistLink>http://www.zcool.com.cn</artistLink>
<albumLink>http://www.zcool.com.cn</albumLink>
</albuminfo>
</artworkinfo>
帮我看看怎么从数据库读取记录在里面!
还有。 <artLocation>images/album1.jpg</artLocation>
<artist>The Doors</artist>
<albumName>Greatest Hits</albumName>
<artistLink>http://www.zcool.com.cn</artistLink>
<albumLink>http://www.zcool.com.cn</albumLink>
这个部分的内容我要循环读取就想ASP一样。能实现吗? 展开
1个回答
展开全部
你看看段代码,可能对你有所帮助:
<%
Response.ContentType="application/xml"
Response.Expires=0
Response.Write("<?xml version=""1.0"" encoding=""utf-8"" ?>")
%>
<AccessManager>
<%
DB_Name=request("dbname")
if inStr(DB_Name,":/")=0 and inStr(DB_Name,":\")=0 then
DB_Name=server.mappath(DB_Name)
end if
Set CONN = Server.CreateObject("ADODB.CONNection")
'on error resume next
CONN.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&DB_Name
if err.number<>0 then
response.write "<error>Error"&err.description&"</error>"
err.clear
end if
Const adSchemaTables = 20
Const adSchemaColumns = 4
dim rstSchema
Set rstSchema = conn.OpenSchema(adSchemaTables)
Do Until rstSchema.EOF
If rstSchema("TABLE_TYPE")="TABLE" then
response.write " <record table="""&rstSchema("Table_name")&"""></record>"&vbCrlf
End If
rstSchema.MoveNext
Loop
set rstSchema=Nothing
Call closeDB()
%>
<%
SUB closeDB()
If IsNull(rs)=False Then
Set rs=Nothing
End If
CONN.close()
Set CONN=nothing
End SUB
%>
</AccessManager>
<%
Response.ContentType="application/xml"
Response.Expires=0
Response.Write("<?xml version=""1.0"" encoding=""utf-8"" ?>")
%>
<AccessManager>
<%
DB_Name=request("dbname")
if inStr(DB_Name,":/")=0 and inStr(DB_Name,":\")=0 then
DB_Name=server.mappath(DB_Name)
end if
Set CONN = Server.CreateObject("ADODB.CONNection")
'on error resume next
CONN.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&DB_Name
if err.number<>0 then
response.write "<error>Error"&err.description&"</error>"
err.clear
end if
Const adSchemaTables = 20
Const adSchemaColumns = 4
dim rstSchema
Set rstSchema = conn.OpenSchema(adSchemaTables)
Do Until rstSchema.EOF
If rstSchema("TABLE_TYPE")="TABLE" then
response.write " <record table="""&rstSchema("Table_name")&"""></record>"&vbCrlf
End If
rstSchema.MoveNext
Loop
set rstSchema=Nothing
Call closeDB()
%>
<%
SUB closeDB()
If IsNull(rs)=False Then
Set rs=Nothing
End If
CONN.close()
Set CONN=nothing
End SUB
%>
</AccessManager>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询