Subject: ASP Table write out
Posted By: aware Post Date: 9/16/2003 10:06:02 AM
Hi

I've a simpe table whos data I want to show across the srenn as well as down when I get the to the third row (or 4th depends on how it looks. I can write out the data vertically but am having problems with the horizontal. I'm using a for next loop for the horizontal.

The code I'm using is this.

Do until rstSection.EOF
Response.Write "<TR>"
For iRowCounter = 1 to 3
     Response.Write "<TD>"
     If NOT rstSection.EOF then response.write rstSection("AerofoilName")
     Else Response.Write "&nbsp;"
     End If
     Response.write "</TD>"
     rstSection.MoveNext
Next

Loop

But I keep getting the following error
Microsoft VBScript compilation error '800a0400'

Expected statement

/fb/Pages/Wings/SectionDetails.asp, line 61

End If

Is this due to nesting a for next inside a do while?

Do you guys have working code to do this?

Regards

Andy Green
Reply By: Imar Reply Date: 9/16/2003 12:37:47 PM
Hi there,

The error message you get could have been a little clearer, because the problem is related to your If statement. Funny thing is that when I reproduce the problem I get a different error message.

Anyway, you are mixing one-line If statements with 2 line statements:

If NOT rstSection.EOF then response.write rstSection("AerofoilName")Else Response.Write "&nbsp;"

works. But, IMO, it's better to use this:

If Not rstSection.EOF Then
    Response.Write(rstSection("AerofoilName"))
Else
    Response.Write("&nbsp;")
End If

This makes your code easier to read and less prone to errors.

Cheers,

Imar



---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: aware Reply Date: 9/18/2003 2:03:20 AM
Thanks Imar

Not sure what came over me there.

Once I cleaned it up it worked OK.

Regards

Andy G

Go to topic 4248

Return to index page 1044
Return to index page 1043
Return to index page 1042
Return to index page 1041
Return to index page 1040
Return to index page 1039
Return to index page 1038
Return to index page 1037
Return to index page 1036
Return to index page 1035