ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

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 September 13th, 2003, 07:27 PM
amateurASP amateurASP is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 83 amateurASP User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 56 m 48 sec
Reputation Power: 5
Angry more counting for dummies

ok, I am very much an amateur here but I am using a lot ASP to manage a db for the students I work with in a YMCA program. What do I need to change to be able to count and print the # of records (like on a roster)

<%
fp_sQry="SELECT * FROM Results WHERE (Grade = 'Senior') ORDER BY Club ASC"
fp_sDefault="Club="
fp_sNoRecords="No records returned."
fp_sDataConn="2004"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=125
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=23
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>

Thanks, and I'll send you a tax deduction statement for your help!

Reply With Quote
  #2  
Old September 13th, 2003, 09:09 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 12th Plane (10500 - 10999 posts)
 
Join Date: Jun 2003
Posts: 10,829 Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level)Doug G User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 20 h 23 m 12 sec
Reputation Power: 765
This looks like a FrontPage DRW but a regular SQL statement could be

SELECT COUNT(*) AS MyCount FROM Results WHERE (Grade = 'Senior')

Which will return the count of the records.

Reply With Quote
  #3  
Old September 13th, 2003, 10:56 PM
amateurASP amateurASP is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 83 amateurASP User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 14 h 56 m 48 sec
Reputation Power: 5
I tried that b4 I posted the message and it returned an error, do I just replace the existing select statement like this:

<%
fp_sQry="SELECT COUNT(*) as MyCount FROM Results WHERE (Grade = 'Senior') ORDER BY Club ASC"
fp_sDefault="Club="
fp_sNoRecords="No records returned."
fp_sDataConn="2004"
fp_iMaxRecords=256
fp_iCommandType=1
fp_iPageSize=125
fp_fTableFormat=True
fp_fMenuFormat=False
fp_sMenuChoice=""
fp_sMenuValue=""
fp_iDisplayCols=23
fp_fCustomQuery=True
BOTID=0
fp_iRegion=BOTID
%>

or is it a new script?
And then how do i display the results of the count?

Reply With Quote
  #4  
Old September 14th, 2003, 12:57 AM
karsh44's Avatar
karsh44 karsh44 is offline
Just another guy
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jun 2003
Location: Wisconsin
Posts: 2,915 karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level)karsh44 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 13 h 13 m 21 sec
Reputation Power: 76
You would replace the existing statement. To display the results, you will need to use the recordset object. http://www.w3schools.com/ado/ado_intro.asp is a tutorial on this subject.

Reply With Quote
  #5  
Old September 14th, 2003, 10:04 AM
OldJacques's Avatar
OldJacques OldJacques is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: in Orbit mostly
Posts: 148 OldJacques User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
The SQL SELECT COUNT(*) statement can't be ordered by a non-valid field, I think that is what might be throwing the error.
You should use something like:
fp_sQry="SELECT COUNT(*) as MyCount FROM Results WHERE (Grade = 'Senior')"
(since Club wasn't SELECT'ed).
Which gives the number of seniors.

If, on the other hand, you are trying to print a numbered list of all the members, you need to identify (or create, if it doesn't already exist) a loop which prints each senior and relative information on a separate line. As part of the loop, you need to use an variable number which is incremented by one with each iteration of the loop.
The number just gets printed (like the other information) at the beginning of the line (or wherever you need it...).

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > more counting for dummies


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