Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Nested Loop Question
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Lycaster
New Member

USA
60 Posts

Posted - 27 February 2002 :  13:49:49  Show Profile  Visit Lycaster's Homepage  Send Lycaster an AOL message
I have a nested loop, and I am having trouble displaying the loop results correctly.

Here is an example of what the nested loop spits out:

; Hose, Compressed Air; Quality Engineer Supplies;

Each record is separated by a semi-colon. The problem I have is that I need
to remove the semi-colon at the end and the beginning of my results.

Here is my code:

While (NOT oProducts.EOF)
Response.Write "<FONT face=Verdana, Arial, Helvetica, sans-serif size=1><A href=""#"" class=type2links>" & Trim(oProducts.Fields.Item("Pc_Descrip").Value) & "</A>; </FONT>"
oProducts.MoveNext
Wend

Now if I make this a string like:

strString =strString & "<FONT face=Verdana, Arial...

my loop won't work correctly at all.

Thanks for any help!

Jared Wuliger
jared@oxcyon.com
www.oxcyon.com

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 27 February 2002 :  14:15:50  Show Profile
Try this:

Response.Write("<FONT face=Verdana, Arial, Helvetica, sans-serif size=1>")
iCount = 0
While (NOT oProducts.EOF)
if iCount > 0 then
Response.Write("; ")
end if
Response.Write("<A href=""#"" class=type2links>" & Trim(oProducts.Fields.Item("Pc_Descrip").Value) & "</A>")
iCount = iCount + 1
oProducts.MoveNext
Wend
Response.Write("</FONT>")


Nikkol
Go to Top of Page

Lycaster
New Member

USA
60 Posts

Posted - 27 February 2002 :  14:35:58  Show Profile  Visit Lycaster's Homepage  Send Lycaster an AOL message
Nikkol,

That code removed the last semi-colon in my results, but the first one, with a space is still there. Any idea's?

Current Results:

; Hose, Compressed Air; Quality Engineer Supplies

Thanks!


Jared Wuliger
jared@oxcyon.com
www.oxcyon.com
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 27 February 2002 :  14:45:01  Show Profile
Hmmm... do you have any other response.write 's above the current code?

Nikkol
Go to Top of Page

Lycaster
New Member

USA
60 Posts

Posted - 27 February 2002 :  14:52:32  Show Profile  Visit Lycaster's Homepage  Send Lycaster an AOL message
nope, none at all...Is there a way for the counter to recognize the first record and not print the "; "? just in the beginning of the loop?

Jared Wuliger
jared@oxcyon.com
www.oxcyon.com

Edited by - Lycaster on 27 February 2002 14:58:35
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 27 February 2002 :  15:43:33  Show Profile
Look over the edits you made. Nikkol's code looks right to me.


======
Doug G
======
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.89 seconds. Powered By: Snitz Forums 2000 Version 3.4.07