繁体中文
设为首页
加入收藏
当前位置:ASP技术首页 >> ASP应用 >> 用ASP制作在线测试

用ASP制作在线测试

2004-10-01 08:26:10  作者:  来源:互联网  浏览次数:80  文字大小:【】【】【
简介:<% CurQ = Request.Form("CurQ") Answ = Request.Form("Answ") correct=Request.Form("Correct") wrong=Request.Form("Wrong") 'Poor Man's IsNull Code goes her...
关键字:在线测试 制作 ASP

<%

CurQ = Request.Form("CurQ")

Answ = Request.Form("Answ")

correct=Request.Form("Correct")

wrong=Request.Form("Wrong")

'Poor Man's IsNull Code goes here

If PoorMansIsNull(CurQ) Then

CurQ = 1

correct = 0

wrong = 0

End If

If PoorMansIsNUll(Answ) Then

CurQ = CurQ + 1

If CurQ > (Your maximum number of questions) Then

%>

Congratulations. You have completed this test. You missed <%=wrong%>

questions,

but got <%=correct%> questions right. That is equivilent to a

<%=(correct/(max#ofQs)%>%.

Thank you for doing the test.

<% End If %>

<% set conntemp = server.createobject("adoDB.Connection")

set myDSN = '(your DSN info goes here)

conntemp.Open myDSN

set mySQL = "SELECT * FROM QUESTIONS WHERE QuestionID=" & CurQ

set rsTemp= conntemp.Execute(mySQL)

%>

Question Number <%=rsTemp("QuestionID")%>

>

Your question is <%=rsTemp("Question")%>

Answer:

<% Else %>

<% set conntemp = server.createobject("adoDB.Connection")

set myDSN = '(your DSN info goes here)

conntemp.Open myDSN

set mySQL = "SELECT * FROM QUESTIONS WHERE QuestionID=" & CurQ

set rsTemp= conntemp.Execute(mySQL)

If AnsW = rsTemp("CorrectAns") Then

%>

Congratulations. You got it right. Whee

<% correct = correct + 1 %>

<% Else %>

I'm sorry, you missed the question. You can review by

reading:

<%=rsTemp("reference")

<% wrong = wrong + 1 %>

<% End If %>

<% End If %>

责任编辑:admin
相关文章