View Full Version : Help with ASP Database Access
Jaws1080
02-10-2005, 03:04 PM
Ok, I am a little bit familiar with database access as I have an ASP form that enters it's data into an Access Database.
Where I am having trouble is that I want to enter data from a form into a database field that is classified as a number and then write an asp page to tally up all the records in this number column and spit them out to the screen.
Any input would be greatly appreciated!
fractalvibes
02-10-2005, 06:02 PM
Cast the text from the form into the proper type:
Integer:
valueFor Db = CINT(stringFromForm)
real:
valueForDb = CDBL(stringFromForm)
or do the conversion in your sql
INTEGER(stringFromForm) or DECIMAL(stringFromForm)
fv
Jaws1080
02-10-2005, 06:26 PM
Thanks! I'll try that out.
Jaws1080
02-10-2005, 09:29 PM
Well...I think it worked, but I guess now I don't know how to retrieve it and sum it up. I tried this, but I got an error
strQ = "SELECT ID FROM TournamentPlay ORDER BY ID"
Set objRS = objConn.Execute(strQ)
while NOT objRS.EOF
number=number + objRS("FirstHaloTournament")
objRS.MoveNext
wend
Could you give me a little more insight? I'm kind of new to database programming.
Thanks!
fractalvibes
02-11-2005, 05:58 AM
Well, all you did was to return a list of ID columns from the table, nothing really to sum. Post your table structure and what you are trying to do. By the looks of it, you probably just need to do a sum(FirstHaloTournament) in
your sql. And look for a good SQL reference, there really is so much you can
do in your query to the database.
fv
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.