Accessibility
 
Home > Products > Authorware > Support > Tracking and Recording Performance
Macromedia Authorware Support Center - Tracking and Recording Performance

Transferring data using ASP

Microsoft IIS 3.0 and ASP allow web applications to interact with ODBC-compliant databases. The methods required to use ASP for tracking web-packaged Authorware pieces are similar to using the Cold Fusion Application Server. Cold Fusion uses CFM files to interface with the database. The basic differences are that an ASP file contains the database instructions and the URL_string variable is set to the location of the ASP file:

URL_string := "http://nt.server.com/scripts/Quiz1.asp"

The Quiz1.asp file contains the instructions to initialize a connection to the database. The ASP file opens a connection to a data source named aw5quiz. The data source is defined using the ODBC control panel on the server computer. Add the following statements to the Quiz1.asp file to initialize a connection to the database:

<%
If IsObject(Session("aw5quiz_conn")) Then

Set conn = Session("aw5quiz_conn")

Else

Set conn = Server.CreateObject("ADODB.Connection")
conn.open "aw5quiz","",""
Set Session("aw5quiz_conn") = conn

End If
%>

The Quiz1.asp file also contains the following instructions to insert the tracked data into the username, password, and score fields in a database table named Quiz1 . The Quiz1 table is defined in the data source named aw5quiz . This example uses the same data source used in the Cold Fusion example.

<%
username = Request.Form("username")
password = Request.Form("password")
score = Request.Form("score")
sqlstr= "INSERT INTO [Quiz1] "
sqlstr= sqlstr & "(username, password, score)"
sqlstr= sqlstr & "VALUES "
sqlstr= sqlstr & "('" & username & "','" & password & "','" & score & "'" & ")"
Set rs = conn.execute(sqlstr)
Set rs = nothing
%>
Note that inserting values into the database is done with the same SQL INSERT command used with Cold Fusion. ASP retrieves values from the command form with the following syntax:

value=Request.Form("fieldname")

The SQL command is held in a string variable named sqlstr . ASP executes the SQL command when it encounters this statement:

conn.execute(sqlstr)

For more information about ASP, visit learnasp.com.

To Table of Contents Back to Previous document Forward to next document