Wrox Programmer Forums
|
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
 
Old October 24th, 2006, 06:46 AM
Authorized User
 
Join Date: Oct 2006
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update Scoreboard - ASP

Hello,

I am facing a problem in ASP. The scenario is...

I have a database with the following Colums and the data type of all Colums are integer

id|score1 | score2 | score3
------------------------------------
1 | 10 | 4 | 10 |
2 | 5 | 51 | 10 |
3 | 5 | 22 | 10 |
4 | 15 | 54 | 10 |
5 | 7 | 11 | 10 |
6 | 19 | 2 | 10 |
7 | 10 | 1 | 10 |
8 | 12 | 66 | 10 |
9 | 3 | 75 | 10 |
10| 7 | 11 | 10 |



Now, I have a page (search_result.asp) where I can search for scores based on the ids, and each result has a corresponding checkbox (so that I can increase the number of score of a particular ID or multiple IDs )

I have a second page (update_scrore.asp) where I have 3 textboxes where I can enter scores and at the click of a button these scores are added to the selected ID.


I can make it work perfectly fine when It comes to just one score update at a time. But I cannot figure out how to add the score if I am selecting multiple checkboxes i.e. multiple IDs.


For Eg. If I am selecting the checkbox containing the ID 8, and I want to add 30 scores in each 3 colums, the updated value will be 42 | 96 | 40

But I cannot figure out, how should I add and update the colums If I am selecting multiple IDs i.e. 7, 5, 9


I am new to ASP, so please help.


Thanx in Advance....


God Bless



-----------------------------------------------
www.chargertek.in - Cheapest WebHosting
__________________
-----------------------------------------------
www.chargertek.in - Cheapest WebHosting
 
Old October 24th, 2006, 08:28 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

This is a Math problem not an asp problem. Anyway.

Dim iCheckCount
Dim iScore
Dim iFinalScore

iCheckCount = 'Number of checkboxes checked
iScore = 'Total Score to be distributed

iFinalScore = CINT(iScore) / CINT(iCheckCount) 'This tells you how many counts each ROW gets
iFinalScore = iFinalScore / 3 'This tells you how many counts each column in each ROW gets

This is problematic because you are using integers, Given 30 as the count and 3 check boxes checked each column in each Row should get 3.333333 votes (10 / 3) soo since you are storing as integers this should actually get cast to just 3 resulting in only 9 votes being cast per row as opposed to 10. You will need to figure out how you want to deal with this.


-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.

^^Thats my signature





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP UPDATE CLOB mamasagarika Classic ASP Databases 0 December 2nd, 2004 07:14 AM
update using Asp and jscript alyeng2000 Classic ASP Basics 12 November 13th, 2003 09:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.