Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." 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 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 16th, 2003, 10:06 AM
Authorized User
 
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP Table write out

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
 
Old September 16th, 2003, 12:37 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

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.
 
Old September 18th, 2003, 02:03 AM
Authorized User
 
Join Date: Jun 2003
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Imar

Not sure what came over me there.

Once I cleaned it up it worked OK.

Regards

Andy G





Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I write out a record to an SQL db table? furjaw Visual Basic 2005 Basics 1 April 26th, 2006 05:16 PM
How can I write query for override a table?? davekrunal46 SQL Language 7 December 1st, 2005 01:15 AM
Help Needed to write vba for Pivot Table in Excel sunny76 Excel VBA 1 June 28th, 2005 01:44 AM
Converting blank spaces to write a table name. SKE Classic ASP Databases 3 April 12th, 2005 01:32 PM
not able to write check box output into table knight Classic ASP Databases 5 June 7th, 2004 11:40 PM





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