SunQuest
           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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 28th, 2003, 11:28 PM
dj_in_Idaho dj_in_Idaho is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Boise, ID
Posts: 3 dj_in_Idaho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to dj_in_Idaho
Question Counting Records in the DB

I have a question regarding counting records in a database. I have fields called EventName and EventVolunteer. What I want to do is do a count of volunteers for each event. Then as it loops though the database the results display next to the Event Name. I looked around but didn't see anything close to what I'm looking for. Hope this makes sense. Thanks.

Reply With Quote
  #2  
Old July 29th, 2003, 01:29 AM
Shad Shad is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 24 Shad User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Open your recordset (called 'rs' for simplicity here) and do something like:

Code:
SQL = "SELECT DISTINCT EventName FROM table"
If dbOpenQuery(rs,SQL) then
    Do while not rs.EOF
        str = str & rs("EventName") & "<br>"
        SQL2 = "SELECT EventVolunteer FROM table WHERE EventName = '" & rs("EventName") & "'"
        If dbOpenQuery(rs2,SQL2) then
            Do while not rs2.EOF
                str = str & rs2("EventVolunteer") & "<br>"
                rs2.Movenext
            Loop
            dbCloseQuery rs2
        Else
            str = str & "No volunteers...<br>"
        End if
        rs.Movenext
    Loop
    dbCloseQuery rs
Else
    str = str & "No events...<br>"
End if
Response.Write str
dbOpenQuery and dbCloseQuery are 2 of my functions for creating recordsets, but you get the idea. You could do this as well by selecting EventName and EventVolunteer and doing it in one loop, but I can't remember the code to get the pointer number...

As always, more than one way for programming something

Reply With Quote
  #3  
Old July 30th, 2003, 12:35 AM
dj_in_Idaho dj_in_Idaho is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Boise, ID
Posts: 3 dj_in_Idaho User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to dj_in_Idaho
Thanks!

I was actually able to find a solution from the 4guysfromrolla.com forums. Thanks for your reply though.

-dj

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > Counting Records in the DB


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 3 hosted by Hostway