flash+asp+access data load into List component

Source: Internet
Author: User

Simple ASP loads an Access database and generates an XML file, a simple ASP loads an Access database, generates XML, and then loads the XML data into the list component paradigm to learn .

ASP code:

<% @language = "VBScript" @codepage = "65001"%>
<%
' Open an explicit variable declaration
Option Explicit
' Set Output type
Response.contenttype= "Text/xml"
' Defines three variables, conn (Connection object), ConnStr (ConnectionString), SQL (an SQL statement)
Dim conn,connstr,rs,sql,i
' Defines the value of the ConnectionString
I=1
Connstr= "Provider=Microsoft.Jet.OLEDB.4.0;Data source=" &server.mappath ("Test.mdb") & ";"
' Establish a Server connection object
Set Conn=server.createobject ("ADODB. Connection ")
' Set up DataSet objects
Set Rs=server.createobject ("ADODB. RecordSet ")
' Open Data connection
Conn.Open ConnStr
' The meaning of this sentence is to get the values of the first 100 Song1name,dong1url fields in ascending order of the ID field values in the word datasheet. Values are attached to a DataSet object as a property of the dataset.
Sql= "SELECT top [Song1name],[dong1url] from [test] ORDER by id DESC"
' Cursor type and lock type are set to 1, which is a forward-only read-only behavior, the fastest read
Rs.Open sql,conn,1,1
Response.Write ("<?xml version= ' 1.0 ' encoding= ' utf-8 '?>< ', Amoy >")
' Do a while loop, and the condition loops to the last item that meets the criteria
Do as not rs.eof
' This is the modified section so that the output file can be identified by the Loadvars object in Flash.
Response.Write ("< song information >< song name >" &rs ("Song1name") & "</song name >< address >" &rs ("Dong1url")) & "</address ></song information >"
' Record Move Down
Rs.movenext
I=i+1
' Loop method with Do while echoes, the main loop body
Loop
Response.Write ("</Amoy >")
' Close the DataSet object
Rs.close
' Close the database connection
Conn.close
' Releasing DataSet resources
Set rs=nothing
' Free database connection resources
Set conn=nothing
%>
The first chastity in Flash plus the following code

//Definition component
Var my_TextArea:mx.controls.TextArea
var my_List:mx.controls.List;
var my_xml:xml = new XML ();
My_xml.load ("Http://www.111cn.net");
My_xml.onload = function (Ok:boolean) {
if (OK) {
for (i=0; I[TD] My_list.additem ({Label:this.firstChild.chil Dnodes.childnodes[0].childnodes[0].nodevalue, Data:this.firstchild.childnodes.childnodes[1].childnodes[0]. NodeValue});
}
}
};
var my_object:object = new Object ();
My_object.change = function (eventobj:object): Void {
My_textarea.text + = eventobj.target.selecteditem.label+ " \ n ";
};
My_list.addeventlistener ("Change", my_object);

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.