Data | database | Database connection a long time ago found a lot of flash friends post help Flash and database connection, so I studied, decided to write down on the Asp\php\jsp database connection method, today to everyone's flash and database Connection (ASP), I will continue to serve for everyone, I hope you often come to my blog guest! A total of three documents are required (see figure II). First write ASP file, named Save.asp. The specific code is as follows: <%
U_name=request.form ("name")
U_company=request.form ("Company")
U_relation=request.form ("relation")
U_url=request.form ("url")
U_msg=request.form ("MSG")
Set conn=server.createobject ("ADODB. Connection ")
Conn. Open "Driver={microsoft Access Driver (*.mdb)};D bq=" & Server.MapPath ("Msg.mdb")
Sql= "Insert into data (name,company,relation,url,msg) VALUES (' &U_name&" ', ' "&u_company&" ', ' "&u _relation& "', '" &u_url& "," "&u_msg&" ""
Conn. Execute (SQL)
Conn.close
Set conn=nothing
Response.Write "&temp=ok"
%> below we do Access file, named msg.mdb! Create a table and name it as a data table. Create field name: ID; Name; Company; Relation; URL; MSG; Time. Data types are set to: automatic numbering; text; text; text; text; remark; date/time. Save shutdown. Finally we do flash, filename I get up a conn bar! In the work area, follow the map, one layer per component! The new top layer adds the following code to the last chastity:
System.usecodepage = true;
Name = "";
Company = "";
Relation = "";
URL = "";
MSG = "";
function SendData () {
if (Name!= "&& company!=" "&& relation!=" "&& Msg!=" ") {
var MyVar = new Loadvars ();
Myvar.name = Name;
Myvar.company = Company;
Myvar.relation = relation;
Myvar.url = URL;
Myvar.msg = MSG;
Myvar.sendandload ("http://localhost/6/save.asp", MyVar, "POST");
temp = "Submit, please wait ...";
Myvar.onload = function (success) {
if (success) {
temp = "Oh! success!" Come on, one more ... "
Name = "";
Company = "";
Relation = "";
URL = "";
MSG = "";
} else {
TEMP = "Failed!" Maybe there's a problem with the network! ";
}
};
} else {
temp = "Please input integrity!" ";
}
}
Sendbtu.onrelease = function () {
SendData ();
};
Clearbtu.onrelease = function () {
temp = "Welcome to your message!" ";
Name = "";
Company = "";
Relation = "";
URL = "";
MSG = "";
};
Stop (), and then the corresponding input text basket variable to the corresponding name! The variable named the input text basket after the name: name. If you have any questions please leave a message below, I will help you to solve as soon as possible!
Attachment:
figure I