 |
| Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 27th, 2004, 04:10 PM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
shoakat
Hello friends,
I am new to asp and sql server 2000. I have to create an
asp page which calculates the score out of five question given
to the user. If a user scores 5 questions right display should be 50/50.
I dont know with which database I will connect the asp. There are many databases in the sql server 2000 northwind database.Let me know which database to connect.
this is the html code for user
<b>1. What does ASP stand for? </b><br>
<Input type = "radio" name = "txt"> Acronyms are strangely popular<br>
<Input type = "radio" name = "txt"> Active Server Pages<br>
<Input type = "radio" name = "txt"> Actors still over Paid<br>
<Input type = "radio" name ="txt"> Inland Revenue Department<br>
|
|

August 27th, 2004, 08:36 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hello,
Why confusion? You design your own database and connect to that.
And also in the radio buttons, you include value property. B'coz when the form is submitted the value property of radio button is passed.
|
|

August 29th, 2004, 11:04 PM
|
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Rajini is right!! something like :
<b>1. What does ASP stand for? </b><br>
<Input type = "radio" name = "txt" value=1> Acronyms are strangely popular<br>
<Input type = "radio" name = "txt" value=2> Active Server Pages<br>
<Input type = "radio" name = "txt" value=3> Actors still over Paid<br>
<Input type = "radio" name ="txt" value=4> Inland Revenue Department<br>
Then the final values from all the radios could be matched to respective data in the table and you can calculate the score. You can design your db which would have 1st table main category like ASP, SQL SERVER, etc, another table with set of questions related to the subject, like a set for ASP, another set for SQL SERVER, and the third table which would have answers related to the questions selected, well it depends upon how you design.
Regards
sinapra
|
|

August 30th, 2004, 11:44 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
b>1. What does ASP stand for? </b><br>
<Input type = "radio" name = "txt" value=5> Acronyms are strangely popular<br>
<Input type = "radio" name = "txt" value=10> Active Server Pages<br>
<Input type = "radio" name = "txt" value=0> Actors still over Paid<br>
<Input type = "radio" name ="txt" value=0> Inland Revenue Department<br>
I have to calculate the number of answer right
if strQ1=10 then
Response.Write("Your Answer is Active Server Pages")
Response.Write("10" "Correct Answer")
if strQ1=0 then
Response.Write(Your answer is Actors still over paid")
Response.Write("Incorrect answer")
How will I differential Actors still over paid and inland revenue department
becuse the value =0,
Can you please help me
|
|

August 30th, 2004, 08:46 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hi,
You cannot do like that. You give different values to last two radio. What is the problem of giving diff values?
B'coz if you submit the form the value property is submitted. Radio means you can select only on button in a group(i.e giving same name to diff radio buttons will form a radio group).
|
|

August 31st, 2004, 11:42 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by rajanikrishna
Hi,
You cannot do like that. You give different values to last two radio. What is the problem of giving diff values?
B'coz if you submit the form the value property is submitted. Radio means you can select only on button in a group(i.e giving same name to diff radio buttons will form a radio group).
|
|
|

August 31st, 2004, 11:46 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2004
Posts: 119
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
if strQ2=10 then
Response.Write("Your Answer:<%....%") +"<br>"
Response.Write("10"+" " +"Technically Correct")+"<br>"
end if
if strQ2 =2 then
Response.Write("Your Answer:&.....&") +"<br>"
Response.Write( "0" +" "+"Incorrect")+"<br>"
end if
if strQ2=0 then
Response.Write(" You did not answer this Question")+"<br>"
end if
if strQ2 =1 then
Response.Write("Your Answer:!@#$%$%") +"<br>"
Response.Write("1" +" "+"A Bonus point for Creative Answer")+"<br>"
end if
I have to calculate the score out of 50
str Total score =strQ1+strQ2+strQ3 +strQ4 +strQ5 "/50"
if the answer is corect he score 10 points, if its wrong he scores
0 points. Since I have given values 1,2 ,3 ,4 It calculates those also. I DONT KNOW HOW TO HANDLE THIS. yOUR ANSWER WILL BE APPRECIATED
|
|

August 31st, 2004, 08:44 PM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Hello,
Are you generating 5 questions? At a time or one at a time?
I thought that you are generating all at once.
Then, you give the condition with 5 variables(5 radio groups).
As you said, strTotal=((strQ1+strQ2+strQ3+strQ4+strQ5)/50)
for every question, you have 4 radio buttons with diff valuez(10,5,1,0). So strQ1 will have direct values(which one you selected).
If its so, your way is OK. or get it clear.
|
|

August 31st, 2004, 08:59 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Also, forgive me if I'm wrong, but it seems you are mixing ASP JavaScript syntax with ASP VBScript syntax.
So, which are you actually using? Looks more like VBScript, and if it is, you need to change the Response.Write lines to use the & symbol instead of the + symbol for concatenation.
HTH,
Snib
<><
|
|

September 2nd, 2004, 06:14 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
|
|
IMO, except for the correct answer radio, for all other radio, you would give ZERO, so that when you request for all those radios and total them all, you would get the right value.
Imagine as RajaniKrishna suggested, if you give different values(non-zero) to different radios within a group, for each question, when chosen the wrong answer, still that adds up to the total. I assume that is wrong. So you would better give ZERO for all wrong answers and finally total them up based on whatever is being selected.
Also
strTotal=((strQ1+strQ2+strQ3+strQ4+strQ5)/50)
would actually divide the value by 50 and return something in fractions too/error. You should change it as,
strTotal=CStr(strQ1+strQ2+strQ3+strQ4+strQ5) & "/50"
As Snib suggested, you should change all + used in Response.write with &
Why not name the subject of your post with a meaningful phrase, than using your name? I believe that I have pointed out that earlier in one of your posts. This would help other to search on this forum easily for what they are looking for, than searching for your name. Does that make sense?
Hope that helps.
Cheers!
_________________________
- Vijay G
Strive for Perfection
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| shoakat |
shoakat |
Classic ASP Databases |
2 |
August 6th, 2004 09:09 PM |
| Shoakat |
shoakat |
Classic ASP Databases |
4 |
August 4th, 2004 06:46 AM |
| shoakat |
shoakat |
Classic ASP Databases |
0 |
August 3rd, 2004 11:07 AM |
| shoakat |
shoakat |
Classic ASP Databases |
2 |
July 28th, 2004 03:59 PM |
| shoakat |
shoakat |
Classic ASP Databases |
4 |
July 26th, 2004 04:36 PM |
|
 |