|
 |
access_asp thread: ASP Detail Page. Help on asp logic please.
Message #1 by "Claudia Eaton" <bchudak@h...> on Thu, 12 Sep 2002 21:28:05
|
|
I am experiencing difficulties with building the TicketDetail page.
I have build an ACCESS Database, out of which I am retrieving information
about the tickets. First page is the page that has 9 different ticket
categories, when a category link is clicked that brings all tickets from
that category. Click here to check what I mean:
http://www.navylifepnw.com/navylife/itt/Ticket1.asp That works well. On
that page each (record) ticket is a link to a TicketDetail page (this is
how I do it):
(<A HREF=""TicketDetail.asp?TicketID=" & objTicketRS.Fields("TicketID")
& """>" & _
objTicketRS.Fields("TicketName") & "</A>)
That works as well.
However, I seem to be having very hard time building the ASP Logic for the
DetailTicket.asp page.
The functionality that I need is the following:
- I need to Request.QueryString the TicketID that was clicked on the
previous page for example Ticket1.asp:
- I need to query the database for that particular ticketID details (that
was passed in the QueryString)
- I also need to build control statements for 4 different genders. One
Ticket may have the price for child, youth, adult and senior and so I need
to show all of those on the TicketDetail.asp page, another Ticket may only
be available for child and adult, and so now I only want to show those 2
rows.
Here is how I started approaching it:
<!-- ----------------- TicketDetail.asp page --------------------------- --
>
<%@LANGUAGE="VBSCRIPT"%>
<%Option Explicit%>
<!-- #include file="dataconn.asp" -->
<!-- #include file="../includes/adovbs.inc" -->
<HTML>
<HEAD>
<TITLE>Ticket Detail Page.</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
</HEAD>
<BODY>
<!-- database feed table -->
<%
Dim TicketID
TicketID = Request("TicketID")
If TicketID = "" Then
Response.Write "<P>I am sorry, No such ticket exists in our
database</P>"
Dim rsTicket
Set rsTicket = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM Ticket" & _
"WHERE (TicketID=" & TicketID & ") "
rsTicketl.Open, strSQL, objConn, adOpenStatic, adLockReadOnly
Dim MWRSeniorPrice
Dim MWRAdultPrice
Dim MWRChildPrice
Dim MWRYouthPrice
MWRSeniorPrice = rsTicket("MWRSeniorPrice")
MWRAdultPrice = rsTicket("MWRAdultPric")
MWRChildPrice = rsTicket("MWRChildPrice")
MWRYouthPrice = rsTicket("MWRYouthPrice")
Response.Write _
rsTicket("TicketName") & _
"<TABLE BORDER=""2"" CELLSPACING=""2"" CELLPADDING=""1"">"
& _
" <TR>" & _
" <TH BGCOLOR=""#FFCC66""></TH>" & _
" <TH BGCOLOR=""#FFCC66"">MWR Price</TH>" & _
" <TH BGCOLOR=""#FFCC66"">Regular Price</TH>" & _
" <TH BGCOLOR=""#FFCC66"">More Resources</TH>" & _
" <TH BGCOLOR=""#FFCC66"">Avialable at:</TH>" & _
" </TR>" & _
If MWRSeniorPrice = "" Then '
<-------VBScript compilation (0x800A03EA)
Reponse.Write _
" <TR>" & _
" <TD BGCOLOR=""#ECECEC"">Senior</TD>" & _
" <TD BGCOLOR=""#ECECEC"">" & rsTicket ("MWRSeniorPrice")
& "</TD>" & _
" <TD BGCOLOR=""#ECECEC"">" & rsTicket ("PubSeniorPrice")
& "</TD>" & _
" <TD BGCOLOR=""#ECECEC"">" & rsTicket ("ResourceLink")
& "</TD>" & _
" <TD BGCOLOR=""#ECECEC"">" & rsTicket ("WSRTV") & "</TD>"
& _
" </TR>" & _
End If
If MWRAdultPrice = "" Then
Reponse.Write _
" <TR>" & _
" <TD BGCOLOR=""#ECECEC"">Adult</TD>" & _
" <TD BGCOLOR=""#ECECEC"">" & rsTicket ("MWRAdultPrice")
& "</TD>" & _
" <TD BGCOLOR=""#ECECEC"">" & rsTicket ("PublicAdultPrice")
& "</TD>" & _
" <TD BGCOLOR=""#ECECEC""><A HREF="& rsTicket
("ResourceLink") & ">rsTicket("ResourceLink") & "</A>& "</TD>" & _
" <TD BGCOLOR=""#ECECEC"">" & rsTicket ("NorthSoundSales")
& "</TD>" & _
" </TR>" & _
End If
If MWRChildPrice = "" Then
Reponse.Write _
" <TR>" & _
" <TD BGCOLOR=""#ECECEC"">Child</TD>" & _
" <TD BGCOLOR=""#ECECEC"">" & rsTicket ("MWRChildPrice")
& "</TD>" & _
" <TD BGCOLOR=""#ECECEC"">" & rsTicket ("PublicChildPrice")
& "</TD>" & _
" <TD BGCOLOR=""#ECECEC""><A HREF="& rsTicket("ResourceLink")
& ">rsTicket("ResourceLink") & "</A>& "</TD>" & _
" <TD BGCOLOR=""#ECECEC"">" & rsTicket ("WestSoundSales")
& "</TD>" & _
" </TR>" & _
End If
If MWRYouthPrice = "" Then
Reponse.Write _
" <TR>" & _
" <TD BGCOLOR=""#ECECEC"">Youth</TD>" & _
" <TD BGCOLOR=""#ECECEC"">" & rsTicket ("MWRYouthPrice")
& "</TD>" & _
" <TD BGCOLOR=""#ECECEC"">" & rsTicket ("PublicYouhPrice")
& "</TD>" & _
" <TD BGCOLOR=""#ECECEC""><A HREF="& rsTicket("ResourceLink")
& ">rsTicket("ResourceLink") & "</A>& "</TD>" & _
" <TD BGCOLOR=""#ECECEC"">" & rsTicket ("EastSoundSales")
& "</TD>" & _
" </TR>" & _
rsTicket.Close
rsTicket = Nothing
Response.Write "</TABLE>"
%>
<BR>
<!-- Addresses & Conatcts start here -->
<!-- #include file="itt_contacts.asp" -->
<!-- End of Addresses & Conatcts here -->
<!--#include file="../copyright.inc" -->
</BODY>
</HTML>
I get Microsoft VBScript compilation (0x800A03EA)
Syntax error
/navylife/itt/TicketDetail.asp, line 43
Here is that line of code that causes problem:
If MWRSeniorPrice = "" Then ' <-------VBScript compilation (0x800A03EA)
Your feedback on that problem solving issue will be greatly appreciated.
Thanks in advance,
Message #2 by "Omar Esquivel" <omare@u...> on Thu, 12 Sep 2002 23:54:29
|
|
I was taking a look at your code, and noticed the following:
You´re declaring your Recordset variable like this:
Dim rsTicket
Set rsTicket = Server.CreateObject("ADODB.Recordset")
-------
But when you´re creating an instance of the variable you define it like
this:
rsTicketl.Open, strSQL, objConn, adOpenStatic, adLockReadOnly
Instead of just rsTicket.Open (without the 1 at the end)
--------
So when you assign a value from a recordset field to your variable
MWRSeniorPrice = rsTicket("MWRSeniorPrice")
There´s no recordset open for rsTicket, because you created an instance
for rsTicket1 instead.
Hope this helps to solve your problem.
Omare
-------------------------------------------------------------
> I am experiencing difficulties with building the TicketDetail page.
I> have build an ACCESS Database, out of which I am retrieving
information
a> bout the tickets. First page is the page that has 9 different ticket
c> ategories, when a category link is clicked that brings all tickets from
t> hat category. Click here to check what I mean:
h> ttp://www.navylifepnw.com/navylife/itt/Ticket1.asp That works well. On
t> hat page each (record) ticket is a link to a TicketDetail page (this is
h> ow I do it):
> (<A HREF=""TicketDetail.asp?TicketID=" & objTicketRS.Fields("TicketID")
&> """>" & _
o> bjTicketRS.Fields("TicketName") & "</A>)
T> hat works as well.
> However, I seem to be having very hard time building the ASP Logic for
the
D> etailTicket.asp page.
> The functionality that I need is the following:
-> I need to Request.QueryString the TicketID that was clicked on the
p> revious page for example Ticket1.asp:
-> I need to query the database for that particular ticketID details
(that
w> as passed in the QueryString)
-> I also need to build control statements for 4 different genders. One
T> icket may have the price for child, youth, adult and senior and so I
need
t> o show all of those on the TicketDetail.asp page, another Ticket may
only
b> e available for child and adult, and so now I only want to show those 2
r> ows.
> Here is how I started approaching it:
> <!-- ----------------- TicketDetail.asp page ---------------------------
--
>>
<> %@LANGUAGE="VBSCRIPT"%>
<> %Option Explicit%>
<> !-- #include file="dataconn.asp" -->
<> !-- #include file="../includes/adovbs.inc" -->
<> HTML>
<> HEAD>
<> TITLE>Ticket Detail Page.</TITLE>
<> META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<> /HEAD>
<> BODY>
<> !-- database feed table -->
> <%
> Dim TicketID
> TicketID = Request("TicketID")
> If TicketID = "" Then
> Response.Write "<P>I am sorry, No such ticket exists in our
d> atabase</P>"
> Dim rsTicket
> Set rsTicket = Server.CreateObject("ADODB.Recordset")
> strSQL = "SELECT * FROM Ticket" & _
> "WHERE (TicketID=" & TicketID & ") "
> rsTicketl.Open, strSQL, objConn, adOpenStatic, adLockReadOnly
>
> Dim MWRSeniorPrice
> Dim MWRAdultPrice
> Dim MWRChildPrice
> Dim MWRYouthPrice
>
> MWRSeniorPrice = rsTicket("MWRSeniorPrice")
> MWRAdultPrice = rsTicket("MWRAdultPric")
> MWRChildPrice = rsTicket("MWRChildPrice")
> MWRYouthPrice = rsTicket("MWRYouthPrice")
>
> Response.Write _
> rsTicket("TicketName") & _
> "<TABLE BORDER=""2"" CELLSPACING=""2"" CELLPADDING=""1"">"
&> _
> " <TR>" & _
> " <TH BGCOLOR=""#FFCC66""></TH>" & _
> " <TH BGCOLOR=""#FFCC66"">MWR Price</TH>" & _
> " <TH BGCOLOR=""#FFCC66"">Regular Price</TH>" & _
> " <TH BGCOLOR=""#FFCC66"">More Resources</TH>" & _
> " <TH BGCOLOR=""#FFCC66"">Avialable at:</TH>" & _
> " </TR>" & _
> If MWRSeniorPrice = "" Then '
<> -------VBScript compilation (0x800A03EA)
> Reponse.Write _
> " <TR>" & _
> " <TD BGCOLOR=""#ECECEC"">Senior</TD>" & _
> " <TD BGCOLOR=""#ECECEC"">" & rsTicket ("MWRSeniorPrice")
&> "</TD>" & _
> " <TD BGCOLOR=""#ECECEC"">" & rsTicket ("PubSeniorPrice")
&> "</TD>" & _
> " <TD BGCOLOR=""#ECECEC"">" & rsTicket ("ResourceLink")
&> "</TD>" & _
> " <TD BGCOLOR=""#ECECEC"">" & rsTicket ("WSRTV")
& "</TD>"
&> _
> " </TR>" & _
> End If
> If MWRAdultPrice = "" Then
> Reponse.Write _
> " <TR>" & _
> " <TD BGCOLOR=""#ECECEC"">Adult</TD>" & _
> " <TD BGCOLOR=""#ECECEC"">" & rsTicket ("MWRAdultPrice")
&> "</TD>" & _
> " <TD BGCOLOR=""#ECECEC"">" & rsTicket ("PublicAdultPrice")
&> "</TD>" & _
> " <TD BGCOLOR=""#ECECEC""><A HREF="& rsTicket
(> "ResourceLink") & ">rsTicket("ResourceLink") & "</A>& "</TD>" & _
> " <TD BGCOLOR=""#ECECEC"">" & rsTicket ("NorthSoundSales")
&> "</TD>" & _
> " </TR>" & _
> End If
> If MWRChildPrice = "" Then
> Reponse.Write _
> " <TR>" & _
> " <TD BGCOLOR=""#ECECEC"">Child</TD>" & _
> " <TD BGCOLOR=""#ECECEC"">" & rsTicket ("MWRChildPrice")
&> "</TD>" & _
> " <TD BGCOLOR=""#ECECEC"">" & rsTicket ("PublicChildPrice")
&> "</TD>" & _
> " <TD BGCOLOR=""#ECECEC""><A HREF="& rsTicket
("ResourceLink")
&> ">rsTicket("ResourceLink") & "</A>& "</TD>" & _
> " <TD BGCOLOR=""#ECECEC"">" & rsTicket ("WestSoundSales")
&> "</TD>" & _
> " </TR>" & _
> End If
> If MWRYouthPrice = "" Then
> Reponse.Write _
> " <TR>" & _
> " <TD BGCOLOR=""#ECECEC"">Youth</TD>" & _
> " <TD BGCOLOR=""#ECECEC"">" & rsTicket ("MWRYouthPrice")
&> "</TD>" & _
> " <TD BGCOLOR=""#ECECEC"">" & rsTicket ("PublicYouhPrice")
&> "</TD>" & _
> " <TD BGCOLOR=""#ECECEC""><A HREF="& rsTicket
("ResourceLink")
&> ">rsTicket("ResourceLink") & "</A>& "</TD>" & _
> " <TD BGCOLOR=""#ECECEC"">" & rsTicket ("EastSoundSales")
&> "</TD>" & _
> " </TR>" & _
> rsTicket.Close
> rsTicket = Nothing
> Response.Write "</TABLE>"
> %>
> <BR>
> <!-- Addresses & Conatcts start here -->
> <!-- #include file="itt_contacts.asp" -->
> <!-- End of Addresses & Conatcts here -->
> <!--#include file="../copyright.inc" -->
<> /BODY>
<> /HTML>
> I get Microsoft VBScript compilation (0x800A03EA)
S> yntax error
/> navylife/itt/TicketDetail.asp, line 43
> Here is that line of code that causes problem:
I> f MWRSeniorPrice = "" Then ' <-------VBScript compilation
(0x800A03EA)
> Your feedback on that problem solving issue will be greatly appreciated.
T> hanks in advance,
Message #3 by "Claudia Eaton" <bchudak@h...> on Fri, 13 Sep 2002 00:27:08
|
|
Omar,
Thanks for your reply.
You are right! Good catch! I changed that typo. rsTicket1 to rsTicket
When running the page, I am still experiencing problems with the following
line of code:
If MWRSeniorPrice = "" Then
I am receiving the folllowing error message:
VBScript compilation (0x800A03EA)
The functionality that I need from this page is the following:
- I need to Request.QueryString the TicketID that was clicked on the
previous page for example Ticket1.asp:
- I need to query the database for that particular ticketID details (that
was passed in the QueryString)
- I also need to build control statements for 4 different genders. One
Ticket may have the price for child, youth, adult and senior and so I need
to show all of those on the TicketDetail.asp page, another Ticket may only
be available for child and adult, and so now I only want to show those 2
rows.
Would you please verify the page one more time and point me where I need
to go to be able to achieve those goals?
Thanks in advance for your time and expertise,
Claudia
|
|
 |