access|asp+| counter
Although the counter does not have to use the database, but I this counter is really very very simple
Most of it was inspired by guoy_8186, and his voting tutorials were really good.
Flash Code:
var count = new Loadvars (); Create a Loadvars object
Count.load ("Your Path/write.asp", count); Reading ASP files
Count.onload = function (success) {
if (success) {
visits = Count.total;
//above is to determine whether read completed, after the completion of the read to the variable assigned to the scene
};
ASP code:
<%
Dim rs
Dim sql
Dim conn ' Defines a variable
Set Rs=server.createobject ("Adodb.recordset") ' Create DataSet object
conn = "dbq=" + Server.MapPath ("Counter.mdb") + ";D efaultdir=;D river={microsoft Access DRIVER (*.mdb)};" ' Database connection statement, default is your space root directory, if the database file is preceded by a folder path to add to
Sql= "Update count set num=num+1 where id=1" ' Give num this value plus 1 statement
Rs.Open sql,conn,1,1 ' Execute write
Sql2= "SELECT * from Count where id=1" read statements
Rs.Open sql2,conn,1,1 ' perform read
If not rs.eof then
Total=rs ("num") ' assigns a value to a variable in the database
Response.Write "&total=" &total& "&" ' Write data in a form that flash can read
Else
End If
Set rs=nothing
Set conn=nothing
%>
Database with access, build a database called counter, in which a new table called count, the table only need to create two fields, a call ID, type automatic numbering, set as the primary key, another called num, the type is a number, this field is the place where the data is stored.
That's OK! Each time you open this Flash file will add 1 in the database, because read into the flash is a variable, you can handle it at will. Attached source code Download: Click here to download the source file