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)
 Loop Problem :: Help Please
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Lycaster
New Member

USA
60 Posts

Posted - 21 March 2002 :  16:52:45  Show Profile  Visit Lycaster's Homepage  Send Lycaster an AOL message
I need some help with this loop I have.

There is a semi-colon and a space before everyone of my printed results.

Example:

; Hose, Compressed Air; Quality Engineer Supplies

I have been trying to get it to display like this:

Hose, Compressed Air; Quality Engineer Supplies

Now someone in this forum helped me by giving me this code:

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>")


Now this should take care of the problem. All it does is remove the last semi-colon that used to show up at the end of the results.

Is there any hope for me?

Thanks for any help!!!



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

Lycaster
New Member

USA
60 Posts

Posted - 21 March 2002 :  17:00:50  Show Profile  Visit Lycaster's Homepage  Send Lycaster an AOL message
Okay, now I feel dumb...or maybe tierd. I got it all I had to do was change:


If iCount > 0 Then
Response.Write("; ")
End If


to:


If iCount > 1 Then
Response.Write("; ")
End If


Silly me.

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

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 21 March 2002 :  17:20:38  Show Profile
Are you sure that the first record doesn't contain an empty value? The code you first post should work. Try adding the code in red below and see what happens.

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
If oProducts("Pc_Descrip") = "" Then response.write("oops! empty value!")
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

asp_storm
Average Member

USA
787 Posts

Posted - 21 March 2002 :  17:43:57  Show Profile  Visit asp_storm's Homepage  Send asp_storm an AOL message
i got a loop question also...how would i make so that it loops to create 6 thumbinals out of a db and if there is more..have it create anotha page?



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.21 seconds. Powered By: Snitz Forums 2000 Version 3.4.07