37
Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at Albany, SUNY 1400 Washington Ave. Albany, NY 12222 phone: (518) 437-4794 e-mail: [email protected]

Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

Web Surveys: Capturing Data Using ASP and Access

SUNY AIRPO Presentation, 6/17/2004

Jeff Gerken

Office of Institutional Research, UAB 321University at Albany, SUNY1400 Washington Ave.Albany, NY 12222phone: (518) 437-4794e-mail: [email protected]

Page 2: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

Special Thanks for helpful ideas to: Mark A. PalladinoResearch SpecialistOffice of Institutional Research, Planning and AssessmentDrexel Universityhttp://www.drexel.edu/provost/ir/neair 

and

http://www.4guysfromrolla.com/webtech/faq/faqtoc.shtml

Page 3: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

Web links to the survey: Manually to type in an ID http://web.albany.edu/ir/airpo/default.htm or With a hotlink in an email already containing the ID https://web.albany.edu/ir/surveys/airpo/idcheck.asp?surveyid=airpo25

Page 4: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

Welcome screen

Email with ID hotlink

ID check

Manually Enter ID

Cookies error

Survey Instrument Data insert

Thanks

OR

default.htm

default.asp

idcheck.asp

error_cookies.asp

survey.asp datainsert.asp

thanks.asp

ID errorstill in idcheck.asp

Page 5: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

--Folder with Access database airpo.mdb--Upsized version of Access database link only

--Server folder with default entry page default.htm--Server secure folder with

--Enter ID default.asp--ID check idcheck.asp

--If no cookies error_cookies.asp--Survey instrument survey.asp--Insert data datainsert.asp--Thank you thanks.asp

Folder structure

Page 6: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

default.htm

Page 7: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

default.asp

Page 8: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

idcheck.asp

Page 9: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

survey.asp

Page 10: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

thanks.asp

Page 11: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 12: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 13: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 14: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 15: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 16: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 17: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 18: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 19: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 20: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 21: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 22: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 23: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 24: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 25: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 26: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at
Page 27: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

default.htm

<FORM name="LoginForm" action="https://web.albany.edu/ir/surveys/airpo/default.asp" LANGUAGE="JavaScript" enctype="multipart/form-data"> <CENTER> <input type="submit" value="Click Here to Go to the Survey"> </CENTER> </form>

Page 28: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

default.asp <FORM name="LoginForm" action="idcheck.asp?<%=Request.QueryString%>" method = "get" LANGUAGE="JavaScript" > <CENTER> <INPUT type = "text" name="surveyid" maxlength="13" length="13" size="13"> <INPUT type="submit" value = "Submit"> <input type="reset" value="Reset"> </CENTER> </form>

Page 29: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

idcheck.asp (part 1 of 3) <% SQLcommand = "SELECT surveyid, IsVisit, Visit_date from ssn_airpo where surveyid = '" & Request.QueryString("surveyid") & "'" Set rs = Server.createObject("ADODB.Recordset") rs.open SQLcommand,"DSN=IRSurv; UID=IRSurv; PWD=*******",0,3 ' check if the surveyid is in the database, EOF means End Of File IF rs.EOF THEN ' surveyid not found in the database rs.Close%> <HTML> You have not keyed in your Survey-ID yet.<FORM name="mesg" action="default.asp">

<input type = "submit" value ="Manual Survey-ID Entry"></FORM></HTML>

Page 30: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

idcheck.asp (part 2 of 3) 

<%ELSE ' found the student, next check if already visited. if rs.Fields("IsVisit") = No then ' new to the survey, write cookie, go to next page Dim id2pass id2pass=Request.QueryString("surveyid") 'write id to cookie Response.Cookies("UserName")=id2pass%> 

<HTML>Your Survey-ID Number has been verified<br>Please click the button below to go to the survey.</H3><form NAME="LoginForm" action="survey.asp?" METHOD=POST LANGUAGE="JavaScript" ><center><input type=submit value = "AIRPO Institutional Research Survey"></form></HTML>

Page 31: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

idcheck.asp (part 3 of 3) <% else %><HTML>Our records show that you have already submitted yourresponses on <%=rs.Fields("Visit_Date")%></HTML> <%rs.Close end if%> <%END IF%>

Page 32: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

Survey.asp (part 1 of 2)

<%Dim id2passid2pass=Request.Cookies("UserName")if id2pass = "" then response.redirect("error_cookies.asp")%>

<% else %>

Page 33: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

Survey.asp (part 2 of 2) <FORM NAME="oiss" ACTION="datainsert.asp" METHOD="Post">College/University: <input type="text" name="college" size="35" maxlength="75"> Have you been accepted yet? <input type="radio" name="accepted" value="1"> Yes <input type="radio" name="accepted" value="0"> No Click the SUBMIT button to send your responses<input type="submit" value="Submit" name="submit"> </form> <% end if %>

Page 34: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

datainsert.asp (page 1 of 3) <%

Set ServerConn = Server.createObject("ADODB.Connection") ServerConn.open "DSN=IRSurv; UID=IRSurv; PWD=******

Set ServerCmd = Server.CreateObject("ADODB.Command")Set ServerCmd.ActiveConnection = ServerConn

 Dim id2passid2pass=Request.Cookies("UserName")Dim surveyidsurveyid = id2passif surveyid = "" then surveyid = "_LOSTSURVEYID_"end if

Page 35: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

datainsert.asp (page 2 of 3) 

college= Smoothquotes(Request("college"))accepted= Request("accepted")fincomm= Smoothquotes(Request("fincomm"))Function smoothquotes (text)

smoothquotes = replace (text,"'","''")End Function 

FieldList=""FieldList=FieldList & "[surveyid],"FieldList=FieldList & "[college],"FieldList=FieldList & "[accepted],"FieldList=FieldList & "[fincomm]" 

SQLCommand= ""SQLCommand= SQLCommand & "INSERT INTO response_airpo"SQLCommand= SQLCommand & "(" & FieldList & ")"SQLCommand= SQLCommand & "values ("SQLCommand= SQLCommand & "'"& surveyid &"',"SQLCommand= SQLCommand & "'"& college &"',"SQLCommand= SQLCommand & "'"& accepted &"',"SQLCommand= SQLCommand & "'"& fincomm &"')"

ServerCmd.CommandText = SQLCommandServerCmd.CommandType = 1ServerCmd.Execute

Page 36: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

datainsert.asp (page 3 of 3) ' reset the visit_date and IsVisit fields in the table ssn_database, so every user ' may just have one record in the system SQLCommand = "" SQLCommand = "UPDATE ssn_airpo set IsVisit = 1, Visit_Date = Getdate(), IPAddress = '" &

request.ServerVariables("remote_host") & "' where surveyid ='" & Request.Cookies("UserName") & "'" ServerCmd.CommandText = SQLCommand

ServerCmd.CommandType = 1ServerCmd.ExecuteSet ServerCmd = NothingServerConn.Closeset ServerConn = Nothing

  'Reinitialize the surveyid in the cookie to protect against multiple submissionsdidit = ""didit="_REPEAT_" & id2pass  'write id to cookie Response.Cookies("UserName")=didit  'Redirect to the final thanks page Response.redirect("Thanks.asp") %>

Page 37: Web Surveys: Capturing Data Using ASP and Access SUNY AIRPO Presentation, 6/17/2004 Jeff Gerken Office of Institutional Research, UAB 321 University at

thanks.asp

<% session("StudentId") = "" %>