Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 29th, 2004, 09:15 AM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default response.write


here is part of my code:


do until rs.EOF
        intTrainingDay=0
        strTrainingTime = ""
        corpscount=corpscount+1


        if strLang="e" then
            select case rs("elementid")

                case 1
                            Response.Write "<h4 class=sea>Sea<br>"
                case 2
                    Response.Write "<h4 class=army>Army<br>"
                case 3
                    Response.Write "<h4 class=air>Air<br>"
            end select

    end if

--------------------------------------------------------------

and this is the output, what i want is to have output only ONE "Sea" instead of having a Sea for each units. If you see below you will notice that there are 3 Units all within the Sea category but I want to have only ONE Sea to show up as the Category and have the Units follow bellow that. And hide the Sea for the other Units.

----------------------------------------------------------------



Sea
6 Victory
2055 DRUMMOND ST, MONTRÉAL, QC

Voice mail: 1-888-690-2236, followed by 471-0006 + #
Email: 6marine@cadets.net


Unit trains Saturdays at 09H00

top of page

Sea
188 Trafalgar
6755 36E Avenue, Montréal, QC

Voice mail: 1-888-690-2236, followed by 471-0188 + #
Email: 188marine@cadets.net


Unit trains Sundays at 09H00

top of page

Sea
233
École sec. Jean-Grou, 12725 boul Rodolphe-Forget, Montréal, QC

Voice mail: 1-888-690-2236, followed by 471-0233 + #
Email: 233marine@cadets.net


Unit trains Mondays at 18:00

------------------------------------------------------

Can someone help me out here with this problem.

Thanks for your help.




Reply With Quote
  #2 (permalink)  
Old September 29th, 2004, 09:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , United Kingdom.
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

Just keep track of what the last elementid was and only write out Sea etc when elementid changes, i.e. when rs("elementid") <> lastElementId.
Reply With Quote
  #3 (permalink)  
Old September 29th, 2004, 09:41 AM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the answer but could you write the full example string to guide me because i am kind of new in this and i am still learning..

Thanks.

Reply With Quote
  #4 (permalink)  
Old September 29th, 2004, 09:55 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Code:
Dim lastElementId
do until rs.EOF
        intTrainingDay=0
        strTrainingTime = ""
        corpscount=corpscount+1

    If lastElementId <> rs("elementid") then
        lastElementId = rs("elementid")
        if strLang="e" then
            select case rs("elementid")
                case 1
                    Response.Write "<h4 class=sea>Sea<br>"
                case 2
                    Response.Write "<h4 class=army>Army<br>"
                case 3
                    Response.Write "<h4 class=air>Air<br>"
            end select
       End If
    end if
    Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #5 (permalink)  
Old September 29th, 2004, 10:13 AM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks happygv you rock man i added the code to my script and Voila it worked like a charmed... again thanks.;)

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Response.Write won't work? Ron Howerton JSP Basics 1 March 23rd, 2007 07:39 AM
response.write crmpicco Classic ASP Basics 1 January 27th, 2005 06:31 PM
Response.write Sach Classic ASP Components 5 March 19th, 2004 06:40 AM
Response.Write an SSI hcweb Classic ASP Basics 2 November 2nd, 2003 05:21 PM



All times are GMT -4. The time now is 12:37 PM.


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