Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old November 25th, 2003, 08:37 PM
Signuml99 Signuml99 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: illinois
Posts: 2 Signuml99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Signuml99
Update database/count statement

i am trying to create a question page, i am useing a select/ case statement to to query my ansmap. but i know i need to have a count statement but i am unsure on how to do that. can any one assist.

here is my code


<%
dim ansMap1, ansMap2, ansMap3, ansMap4, ansMap5, ansMap6, ansMap7, ansMap8, ansMap9, ansMap10, Count, Total, Form1, strUserName, StrScore, StrCorrectAnswer
set rs = Server.CreateObject("ADODB.Connection")
conn.open "Driver={Microsoft Access Driver (*.mdb)};DBQ=e:\home\shughes\db\final.mdb"



rs.open"quiz", conn, 1,3
rs.addnew
rs("score") = strScore

' annswer key '

ansMap1="d"
ansMap2="b"
ansMap3="a"
ansMap4="a"
ansMap5="b"
ansMap6="c"
ansMap7="b"
ansMap8="c"
ansMap9="b"
ansMap10="a"

'count function'

Do while Count > 0
count = count + CorrectAnswer


form1 = Request.Form("Form1")

' select from form1 statement '
for loop
select case form1

case "select1"
if "select1" = "ansMap1" then
CorrectAnswer = count+1
end if
case "select2"
if "select1" = "ansMap1" then
CorrectAnswer = count+1
end if
case "select3"
if "select1" = "ansMap1" then
CorrectAnswer = count+1
end if
case "select4"
if "select1" = "ansMap1" then
CorrectAnswer = count+1
end if
case "select5"
if "select1" = "ansMap1" then
CorrectAnswer = count+1
end if
case "select6"
if "select1" = "ansMap1" then
CorrectAnswer = count+1
end if
case "select7"
if "select1" = "ansMap1" then
CorrectAnswer = count+1
end if
case "select8"
if "select1" = "ansMap1" then
CorrectAnswer = count+1
end if
case "select9"
if "select1" = "ansMap1" then
CorrectAnswer = count+1
end if
case "select10"
if "select1" = "ansMap1" then
CorrectAnswer = count+1
end if


end select
loop
' insert update statement'

strQuery = "update Final set Score = '" & strCorrectAnswer & "' where Username = '" & strUserName & "'"
Conn.execute(strQuery)

%>

<div align="center">
<h1>The Dreaded Quiz</h1>
<p>Please answer as many as you can!</p>
<p>Good Luck, you will need it.</p>
<p>&nbsp;</p>
<form name="form1" method="post" action="quizscore.html">
<p align="left">
<select name="select1">
<option>A</option>
<option>B</option>
<option>C</option>
<option>D</option>
</select>
Question 1. What is the first thing that happens when you power on a cell phone, what does it look for? </p>
<p align="center"> A. Operations System &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;B. Electronic Serial Number &nbsp;&nbsp;&nbsp;&nbsp;C. Mobile Identification number &nbsp;&nbsp;&nbsp;&nbsp; D. System Identification code </p>
<p align="left">

Reply With Quote
  #2  
Old November 26th, 2003, 12:35 PM
alam alam is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 67 alam User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 57 m 17 sec
Reputation Power: 6
- Create a table with all the answers.
- Read the tabel into recordset.
- Use a Loop to check if the answer provided match the recordset.
- Add up all the CorrectAnswer count.

Reply With Quote
  #3  
Old November 26th, 2003, 01:07 PM
Signuml99 Signuml99 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: illinois
Posts: 2 Signuml99 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via AIM to Signuml99
not sure what you mean i am still new at this, kinda flying by the seat of my paints.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Update database/count statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT