Help with code
Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=7007
Printed Date: 31 March 2026 at 3:06pm Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com
Topic: Help with code
Posted By: Tegwin
Subject: Help with code
Date Posted: 05 November 2003 at 12:50am
In my quest to try and learn ASP, I have been trying out some of the
examples on WWF for the connecting to an access database
part1(Guestbook) tutorial ":-
I have been playing with one of the scripts, trying to display the data
in a table, with Headings and then the data in the releavant column
underneath it, this is how I want it to be displayed, but when I
try to do ir I get an error, see below :
| Name |
Comments |
| Tegwin |
Cool
|
| Nodbody |
Wicked
|
Someone else
|
Nice |
Error Type:
Microsoft VBScript compilation (0x800A03EE) Expected ')' /gb/guestbook1.asp, line 37, column 41 Response.Write ("<TABLE BORDER=1 WIDTH=\"75%\" CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER>") --------------------------------------
This is a snippet of the code as to how I am doing it :
'Loop through the recordset
Do While not rsGuestbook.EOF
'Write the HTML to display the current record in the recordset
Response.Write ("<TABLE BORDER=1 WIDTH=\"75%\" CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER>")
Response.Write ("<TR ALIGN=CENTER VALIGN=TOP>")
Response.Write ("<TD ALIGN=CENTER VALIGN=TOP><B>Name</B></TD>")
Response.Write ("<TD ALIGN=CENTER VALIGN=TOP><B>Comments</B></TD>")
Response.Write ("</TR>\n")
Response.Write ("<TR ALIGN=LEFT VALIGN=TOP>");
Response.Write("<TD ALIGN=LEFT VALIGN=TOP>rsGuestbook("Name")</TD>");
Response.Write ("<TD ALIGN=LEFT VALIGN=TOP>rsGuestbook("Comments")</TD>");
Response.Write ("</TR>");
'Move to the next record in the recordset
rsGuestbook.MoveNext
Loop
|
Any help would be much appreciated.!!!
------------- If you dont want my peaches, dont shake my tree
|
Replies:
Posted By: Semikolon
Date Posted: 05 November 2003 at 4:39am
|
Try this:
'Loop through the recordset Do While not rsGuestbook.EOF 'Write the HTML to display the current record in the recordset
Response.Write ("<TABLE BORDER=1 WIDTH="""75%""" CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER>") Response.Write ("<TR ALIGN=CENTER VALIGN=TOP>") Response.Write ("<TD ALIGN=CENTER VALIGN=TOP><B>Name</B></TD>") Response.Write ("<TD ALIGN=CENTER VALIGN=TOP><B>Comments</B></TD>") Response.Write ("</TR>\n")
Response.Write ("<TR ALIGN=LEFT VALIGN=TOP>"); Response.Write("<TD ALIGN=LEFT VALIGN=TOP>rsGuestbook("Name")</TD>"); Response.Write ("<TD ALIGN=LEFT VALIGN=TOP>rsGuestbook("Comments")</TD>"); Response.Write ("</TR>");
'Move to the next record in the recordset rsGuestbook.MoveNext
Loop
|
the reason why you got that error is that u were using " then the script expects a ) and it fails.. u have to use """
|
Posted By: Semikolon
Date Posted: 05 November 2003 at 4:44am
Posted By: Tegwin
Date Posted: 05 November 2003 at 6:18am
Anthrax thanks for that, it has not helped however.. I am still getting the same error message
Error Type:
Microsoft VBScript compilation (0x800A03EE) Expected ')' /gb/guestbook1.asp, line 38, column 42 Response.Write ("<TABLE BORDER=1 WIDTH="""75%""" CELLSPACING=2 CELLPADDING=2 ALIGN=CENTER>") -----------------------------------------^
Any other ideas ?
------------- If you dont want my peaches, dont shake my tree
|
Posted By: Tegwin
Date Posted: 05 November 2003 at 6:54am
I have tried this again by removing the """" and changing it to
WIDTH=75% and it has now stopped complaining about that line but is
having an error on the line that calls the user info
Response.Write ("<TR ALIGN=LEFT VALIGN=TOP>")
Response.Write("<TD ALIGN=LEFT VALIGN=TOP>rsGuestbook("Name")</TD>")
Response.Write ("<TD ALIGN=LEFT VALIGN=TOP>rsGuestbook("Comments")</TD>")
Response.Write ("</TR>")
|
The error coming up now is :-
Error Type:
Microsoft VBScript compilation (0x800A03EE) Expected ')' /gb/guestbook1.asp, line 46, column 55 Response.Write("<TD ALIGN=LEFT VALIGN=TOP>rsGuestbook("Name")</TD>")
Any ideas ?
------------- If you dont want my peaches, dont shake my tree
|
Posted By: michael
Date Posted: 05 November 2003 at 7:27am
Response.Write ("<TR ALIGN=LEFT VALIGN=TOP><TD ALIGN=LEFT
VALIGN=TOP>" & rsGuestbook("Name") & "</TD>")
Response.Write ("<TD ALIGN=LEFT VALIGN=TOP> & rsGuestbook("Comments")& "</TD>")
Response.Write ("</TR>")
|
------------- http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker
|
Posted By: Tegwin
Date Posted: 05 November 2003 at 8:47am
Excellent, Thanks Micheal. that works well. I will learn the formatting of this eventually.. I was nearly right !!!  
------------- If you dont want my peaches, dont shake my tree
|
Posted By: Semikolon
Date Posted: 05 November 2003 at 9:32am
|
oh.. sh*t.. but are your table 75% of window now? it was wrong with """.. it should be "".. ""75%"" that should work.. sorry for the mistake..
|
Posted By: Tegwin
Date Posted: 05 November 2003 at 9:46am
Anthrax its ok it is all working now. I just used width=75
without the "" and it seems to work ok. So I am happy. Thanks to all
for your help anyway..
------------- If you dont want my peaches, dont shake my tree
|
|