I am using action script to pass quiz data to an ASP application that will save the data to a database. The problem that I am experiencing is that when the action script calls the ASP app it inserts a blank record than it will insert my data...."I am pulling my hair out"
I have included the Actionscript and the asp file that it is calling...any suggestions anyone.
*****************************************************************************
ACTION SCRIPT
userScore=(numOfQuestionsAnsweredCorrectly*100)/
(numOfQuestionsAnsweredIncorrectly+numOfQuestionsAnsweredCorrectly)
myDate = new Date();
dateTextField = (mydate.getMonth() + "/" + myDate.getDate() + "/" + mydate.getFullYear());
quiztitle = "FACTS 101"
myData.final=userScore
myData.date = dateTextField
myData.quiz = quiztitle
myData.studentname = username
myData.sendAndLoad(" myData, "POST")
myData = new LoadVars()
myData.onLoad = function(){
if(this.writing=="Ok") {
gotoAndStop(65)
status.text = "Submited data was saved"
} else status.text = "Error in saving submitted data"
trace(this.writing)
trace(dateTextField)
}
stop();
###################################################################
SAVEFLASH.ASP SCRIPT
<%@Language="VBScript"%>
<%
'Option Explicit
Dim oRS, oConn ' Recordset and connection objects
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("students.mdb")
oConn.Open
Set oRS = Server.CreateObject("ADODB.Recordset")
oRS.Open "SELECT * FROM scores", oConn, 2, 3
oRS.AddNew
oRS("Quiz")=Request("quiz")
oRS("Score")=Request("final")
oRS("quizdate")=Request("date")
oRS("user")=Request("studentname")
oRS.Update
Response.Write "writing=Ok&"
' Clean up and say goodbye.
oRS.Close
Set oRS = Nothing
oConn.Close
Set oConn = Nothing
%>
I have included the Actionscript and the asp file that it is calling...any suggestions anyone.
*****************************************************************************
ACTION SCRIPT
userScore=(numOfQuestionsAnsweredCorrectly*100)/
(numOfQuestionsAnsweredIncorrectly+numOfQuestionsAnsweredCorrectly)
myDate = new Date();
dateTextField = (mydate.getMonth() + "/" + myDate.getDate() + "/" + mydate.getFullYear());
quiztitle = "FACTS 101"
myData.final=userScore
myData.date = dateTextField
myData.quiz = quiztitle
myData.studentname = username
myData.sendAndLoad(" myData, "POST")
myData = new LoadVars()
myData.onLoad = function(){
if(this.writing=="Ok") {
gotoAndStop(65)
status.text = "Submited data was saved"
} else status.text = "Error in saving submitted data"
trace(this.writing)
trace(dateTextField)
}
stop();
###################################################################
SAVEFLASH.ASP SCRIPT
<%@Language="VBScript"%>
<%
'Option Explicit
Dim oRS, oConn ' Recordset and connection objects
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};" & _
"DBQ=" & Server.MapPath("students.mdb")
oConn.Open
Set oRS = Server.CreateObject("ADODB.Recordset")
oRS.Open "SELECT * FROM scores", oConn, 2, 3
oRS.AddNew
oRS("Quiz")=Request("quiz")
oRS("Score")=Request("final")
oRS("quizdate")=Request("date")
oRS("user")=Request("studentname")
oRS.Update
Response.Write "writing=Ok&"
' Clean up and say goodbye.
oRS.Close
Set oRS = Nothing
oConn.Close
Set oConn = Nothing
%>