ASP Looping

Stuck indefinetly!!!

Page 1 of 1

2 Replies - 1747 Views - Last Post: 27 May 2002 - 06:20 PM Rate Topic: -----

#1 Fygar  Icon User is offline

  • I liek milk!!1
  • member icon

Reputation: 6
  • View blog
  • Posts: 4,361
  • Joined: 28-March 02

ASP Looping

Posted 23 May 2002 - 07:39 AM

Grrr, loops have been getting on my nerves lately... First I sent 30,000+ e-mails to myself because I forgot to increment the loop with a mail thing in it... now the follwing.

I am trying to fill a grid with ASP. I have two tables open at the same time with this, we will refer to them as X and Y. I am telling it to loop through X, the main data, until it hits the end of the table. Y is going to have more than one record per record in X, so one X record may have many Y records. The Y records are going to fill into subcategory sort of deals.

Basically I am having trouble with a loop writing Y records within the X record, here's what I have right now:

Do Until Rs.EOF 'X record
Body = Body & "<tr><td colspan='5'>&nbsp;</td></tr>"
Body = Body & "<tr>"
Body = Body & "<td class='border' width='16.6%'>&nbsp;" & Rs("TicketDate") & "</td>"'Date
Body = Body & "<td class='border' width='16.6%'>&nbsp;" & Rs("TicketNBR") & "</td>"'Number
Body = Body & "<td class='border' width='16.6%'>&nbsp;" & Rs("TktTransType") & "</td>"'Status
Body = Body & "<td class='border' width='16.6%'>&nbsp;" & Rs("AllcTdQty") & "</td>"'Net Bushel
Body = Body & "<td class='border' width='16.6%'>&nbsp;" & Rs("OwnrCd") & "</td>"'Owner
Body = Body & "</tr><tr>"
'Body = Body & "<td width='16.6%'>&nbsp;N/A</td>"'Quality

'Quality stuff
Do until TickTemp <> Rs("TicketNbr") 'Y records
Body = Body & "<td class='border' width='16.6%'>&nbsp;" & Rs("GrdCd") & "</td>"
Body = Body & "</tr><p>"
Rs.MoveNext
TickTemp = Rs("TicketNbr")
Loop
Loop

I just don't get it... Does ASP have something against using a loop within a loop? That's my guess, or I have some stupid little thing I am over looking... Soooo that's that.


Is This A Good Question/Topic? 0
  • +

Replies To: ASP Looping

#2


Reputation: 0

Re: ASP Looping

Posted 26 May 2002 - 09:14 PM

three things,

first turn off emoticons when posting code, it's hard to see what you are doing when I am looking at all your winks... ;)

second your html is pretty horribly broken since while you are in the subloop you repeatedly close a <tr> but you never open one.  Are all the y's supposed to be in a column to the right?  you should probably close your TR in the X table then use <tr><td colspan='4'>&nbsp;</td> to push your content to the right.  That way you will be in the fifth column with all your content.

third it looks like you will loop endlessly here because you are setting your check variable to the quantity you are checking against.  I could be wrong about this, your code structure is very different from mine but that is what I saw.  ASP has no problem with nested loops so that is not the problem.

Hoopster

Was This Post Helpful? 0

#3 Fygar  Icon User is offline

  • I liek milk!!1
  • member icon

Reputation: 6
  • View blog
  • Posts: 4,361
  • Joined: 28-March 02

Re: ASP Looping

Posted 27 May 2002 - 06:20 PM

Alrighty, yea, Actually I just stuck an if statement in another spot and worked fine... hehe thanks anyways... I did turn off the emoticons too...but they didn't turn off :(
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1