西安网站建设ASP生成XML动态数据读取代码实例

12662014-01-11

西安网站建设ASP生成XML动态数据读取代码实例

<!--#include file="M_conn.asp"-->
<%
username=request("username")
set rshot=server.CreateObject("adodb.recordset")
sql="select * from TZ_all where username='"&username&"' order by id desc"
rshot.open sql,conn,1,1
if not (rshot.eof and rshot.bof) then
i=0
do while not rshot.eof
line=line&"  <value xid="""&i&""">"&rshot("rl_time")&"</value>"&vbcrlf&""
line2=line2&"   <value xid="""&i&""">"&rshot("rl")&"</value>"&vbcrlf&""
i=i+1
rshot.movenext
loop
end if
rshot.close
set rshot=nothing

xmlfile=server.mappath("/party/amline/value_indicator/amline_rl_"&username&".xml")
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile(xmlfile,True)
MyFile.WriteLine("<?xml version=""1.0"" encoding=""UTF-8""?>")
MyFile.WriteLine("<chart>")
MyFile.WriteLine(" <series>")
MyFile.WriteLine line
MyFile.WriteLine(" </series>")
MyFile.WriteLine(" <graphs>")
MyFile.WriteLine("  <graph gid=""1"">")
MyFile.WriteLine line2
MyFile.WriteLine("  </graph>")
MyFile.WriteLine(" </graphs>")
MyFile.WriteLine("</chart>")
MyFile.Close
response.Redirect("m_my_bar.asp?username="&username&"")
%>

 

<%
xmlfile=server.mappath("test1.xml")
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile(xmlfile,True)
MyFile.WriteLine("<?xml version=""1.0"" encoding=""UTF-8""?>")
MyFile.WriteLine("<chart>")

MyFile.WriteLine(" <series>")
MyFile.WriteLine("  <value xid=""0"">1997</value>")
MyFile.WriteLine("  <value xid=""1"">1997</value>")
MyFile.WriteLine(" </series>")

MyFile.WriteLine(" <graphs>")
MyFile.WriteLine("  <graph gid=""1"">")
MyFile.WriteLine("   <value xid=""0"">50</value>")
MyFile.WriteLine("   <value xid=""1"">50</value>")
MyFile.WriteLine("  </graph>")
MyFile.WriteLine(" </graphs>")

MyFile.WriteLine("</chart>")
MyFile.Close
%>
<a href="test1.xml">查看XML文件内容</a>

 

通过本文您对西安网站建设有了进一步了解,本公司温馨提醒:找西安做网站公司,请选择手续齐全、业务精、服务好的正规公司。

工商网上亮照

版权所有:西安点墨网络科技有限公司 信息备案编号: 陕ICP备11004160号-1

客户服务电话:029-89640155 18991365125

公司地址:西安市雁塔区朱雀大街紫郡长安F3

Sitemap 网站地图 手机版

办公电话:029-89640155

服务热线:18991365125

客服信箱:vip@dianmo.cc

846461336327

西安点墨网络科技有限公司

版权所有:西安点墨网络科技有限公司 信息备案编号: 陕ICP备11004160号-1