28,390
社区成员
发帖
与我相关
我的任务
分享
<%
'建立数据库连接
set conn=server.CreateObject("adodb.connection")
conn.open "Provider=SQLOLEDB;Persist Security Info=False;User ID=sa;pwd=123ibm;Data Source=.;Initial Catalog=xz_expressway"
'打开数据库GG表
exec="select top 6 * from test"
set rs=server.createobject("adodb.recordset")
rs.open exec,conn,1,3
'生成xml
xmlfile=server.mappath("./bcastr.xml")
Set fso = CreateObject("Scripting.FileSystemObject")
Set MyFile = fso.CreateTextFile(xmlfile,True)
MyFile.WriteLine("<?xml version=""1.0"" encoding=""utf-8""?>") ‘改用gb2312还是乱码,也不知道为什么了
MyFile.WriteLine("<bcaster autoPlayTime=""3"">")
while not rs.eof
MyFile.WriteLine("<item item_url='"&rs("img")&"' link='1.htm' itemtitle='"&rs("title")&"'></item>")
rs.movenext
wend
rs.close
Set rs = Nothing
conn.close
set conn=Nothing
MyFile.WriteLine("</bcaster>")
MyFile.Close
%>
<?xml version="1.0" encoding="utf-8"?>
<bcaster autoPlayTime="3">
<item item_url='images/01.jpg' link='1.htm' itemtitle='图书1'></item>
<item item_url='images/02.jpg' link='1.htm' itemtitle='图书2'></item>
<item item_url='images/03.jpg' link='1.htm' itemtitle='图书3'></item>
<item item_url='images/04.jpg' link='1.htm' itemtitle='图书4'></item>
<item item_url='images/05.jpg' link='1.htm' itemtitle='图书5'></item>
<item item_url='images/06.jpg' link='1.htm' itemtitle='图书6'></item>
</bcaster>
<div align="center">
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id=scriptmain name=scriptmain codebase="http://download.macromedia.com/pub/shockwave/cabs/
flash/swflash.cab#version=6,0,29,0" width="286" height="261">
<param name="movie" value="bcastr.swf?bcastr_xml_url=bcastr.xml">
<param name="quality" value="high">
<param name=scale value=noscale>
<param name="LOOP" value="false">
<param name="menu" value="false">
<param name="wmode" value="transparent">
<embed src="bcastr.swf?bcastr_xml_url=bcastr.xml" width="286" height="261" loop="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" salign="T" name="scriptmain" menu="false" wmode="transparent"></embed>
</object>
</div>