ASP generates XML document instance program code

Source: Internet
Author: User

XML section:

<?xml version= "1.0" encoding= "gb2312"?>
<bcastr>
<item item_url= '. /uploadpic/2010052660955221.jpg ' link= ' http://www.111cn.net ' <itemtitle= ' ></item>
<item item_url= '. /uploadpic/2010052660981189.jpg ' link= ' http://www.111cn.net ' <itemtitle= ' ></item>
<item item_url= '. /uploadpic/2010052661007093.jpg ' link= ' http://www.111cn.net ' <itemtitle= ' ></item>
<item item_url= '. /uploadpic/2010052661261797.jpg ' link= ' http://www.111cn.net ' <itemtitle= ' ></item>
<item item_url= '. /uploadpic/2010052661302501.jpg ' link= ' http://www.111cn.net ' <itemtitle= ' ></item>
</bcastr>


------------------------------------------------------------------
ASP Tutorial Section:
-------------------------------------------------------------------
<% @language = "VBScript" codepage= "936"%>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
<title> Untitled Document </title>

<body>

<%
' Establish a Database tutorial connection
Set Conn=server.createobject ("Adodb.connection")
DBPath = Server.MapPath (".. /# #25gx ##/#25gx #.mdb ")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data source= "&dbpath
' Open database table
Exec= "SELECT * from Wl_ad"
Set Rs=server.createobject ("Adodb.recordset")
Rs.Open exec,conn,1,3

' Generate XML
Xmlfile=server.mappath (".. /xml/bcastr.xml ")
Set fso = CreateObject ("Scripting.FileSystemObject")
Set myfile = Fso.createtextfile (xmlfile,true)
MyFile.WriteLine ("<?xml version=" "1.0" "encoding=" "gb2312" "?>")
MyFile.WriteLine ("<bcastr>")

Rs.movefirst ' record pointer moves to the first record

While not rs.eof ' executes this loop when the pointer is not to the end


' MyFile.WriteLine ("<item link= '" &rs ("Wl_pic") & "' link= '" &rs ("Wl_url") & "' <itemtitle= '" & RS ("Wl_title") & "' ></item>")
MyFile.WriteLine ("<item item_url=" &rs ("Wl_pic") & "' link= '" &rs ("Wl_url") & "' <itemtitle= '" &rs ("Wl_title") & "' ></item>")

' Output to File

Rs.movenext ' pointer moves to next record

Wend
Rs.close
Set rs = Nothing
Conn.close
Set conn=nothing

MyFile.WriteLine ("</bcastr>")
Myfile.close
%>


<script language= "Web Effects" >
Alert ('::: Update Successful::: ');
</script>
<script language= "Web Effects" >
<!--
function Clock () {i=i-1
if (i>0) settimeout ("clock ();", 1000);
else Self.close ();}
var i=0.5
Clock ();
-->
</script>


</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.