Combined application of Flash and ASP database

Source: Internet
Author: User
Tags exit urlencode access database
Data | Database before looking at this example, first talk about the combination of flash and ASP principle, actually understand a little ASP's friends know ASP is based on HTML.

In fact, the principle of flash and ASP interface and pure ASP file interaction between the principle is the same, simply said that the data exchange between the pages. With this in mind, let's take a look at the following simple example:

The example is to read the data in Access and display it in Flash. This example has three main files, one is Access's database file Employees.mdb, it has a employees table, there are four fields: Id,namelast,lastname,position.

Now let's take a look at the process of making this example. The first shadow frame, action is stop, and there is a text box for the user to enter the query field: Strsearch, a button: Submit, its action is

to (Let go)

Skip to and Play (2)

Exit from

The action of the second shadow frame is: Load parameter ("Employee.asp", 0, Vars=get)

The action is to read the data in an Access database that matches the user's query criteria through an ASP file.


The action of the third Shadow frame is:

if (Namefirst ne "")

Skip to and stop (9)

Exit if

This means that if the namefirst is not equal to a null value, it jumps to the nineth shadow frame, otherwise it will be performed (that is, play the next shadow frame).

第4-7个 Shadow frames have no action oh.

The action for the eighth Shadow frame is:

Skip to and Play (3)

Look back and see the third frame, hehe, do you understand?

If you do not have the data, you will read it until you have read it and jump to the nineth frame.

So let's take a look at the ninth Shadow frame:

A total of three text boxes: namefirst,namelast,position

Data in the database that match the query criteria will be displayed among them.

There is also a button: do It Again

Its action is:

to (Let go)

Skip to and stop (1)

Exit from

Well, let's see employee.asp this file:

Dim ORS, oconn ' defines two variables
Set ORS = Server.CreateObject ("ADODB. Recordset ")" defines ORS as a Recordset object
Set oconn = Server.CreateObject ("ADODB. Connection ")" defines oconn as Connection object
oconn.connectionstring = "Driver={microsoft Access Driver (*.mdb)};
Dbq= "& Server.MapPath (" Employees.mdb ")
oRS.Open "SELECT * from Employees", oconn, 2, 3
' Hey, don't say these two words, right? Open the database Oh
Ors.find "namelast = '" & UCase (Request.QueryString ("Strsearch")) & "'"
' Find the data that matches the criteria

If ors.eof Then ' If the data pointer is in the end
Response.Write "Namelast=not+found&namefirst=not+found&position=not+found"
' Oh, then namelast is not found to meet the conditions of the data slightly
Else
Response.Write "Namefirst="
& Server.URLEncode (ORS ("Namefirst"))
& "&namelast=" & Server.URLEncode (ORS ("Namelast"))
& "&position=" & Server.URLEncode (ORS ("Position"))
' If you find it, you find it. )
End If

Ors.close
Set ORS = Nothing
Oconn.close
Set oconn = Nothing ' closes and empties a database object



Related Article

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.