| Author |
Topic Search Topic Options
|
Tegwin
Senior Member
Joined: 03 September 2003
Location: United Kingdom
Status: Offline
Points: 430
|
Post Options
Thanks(0)
Quote Reply
Topic: Help with code 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
|
 |
Semikolon
Senior Member
Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
|
Post Options
Thanks(0)
Quote Reply
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 """
|
 |
Semikolon
Senior Member
Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
|
Post Options
Thanks(0)
Quote Reply
Posted: 05 November 2003 at 4:44am |
|
or is that wrong??
|
 |
Tegwin
Senior Member
Joined: 03 September 2003
Location: United Kingdom
Status: Offline
Points: 430
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
Tegwin
Senior Member
Joined: 03 September 2003
Location: United Kingdom
Status: Offline
Points: 430
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
michael
Senior Member
Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
|
Post Options
Thanks(0)
Quote Reply
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>")
|
|
|
|
 |
Tegwin
Senior Member
Joined: 03 September 2003
Location: United Kingdom
Status: Offline
Points: 430
|
Post Options
Thanks(0)
Quote Reply
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
|
 |
Semikolon
Senior Member
Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
|
Post Options
Thanks(0)
Quote Reply
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..
|
 |