Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. 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 Databases 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 January 10th, 2006, 07:25 PM
Registered User
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP Page Error **NEED HELP**

I am having a problem with this ASP page. Could anyone help me out with this.

I get an error message on line 300. Below is the page.


<%
    DBOpen

    Synchronize

    numDay = StringToLong(ReadStr("Day"))
    numMonth = StringToLong(ReadStr("Month"))
    numYear = StringToLong(ReadStr("Year"))
    ParishID = StringToLong(ReadStr("ParishID"))

    If Not numMonth>0 Then
        numMonth = Month(Now())
    End If
    If Not numYear>0 Then
        numYear = Year(Now())
    End If

    intFontSize = 3
    If numDay>0 Then
        If IsDate(numMonth & "/" & numDay & "/" & numYear) Then
            intFontSize = 1
            strDate = FormatDateTime(numMonth & "/" & numDay & "/" & numYear,1)
        End If
    End If

    If numMonth>1 Then
        numPrevMonth = numMonth - 1
        numPrevYear = numYear
    Else
        numPrevMonth = 12
        numPrevYear = numYear - 1
    End If
    If numMonth<12 Then
        numNextMonth = numMonth + 1
        numNextYear = numYear
    Else
        numNextMonth = 1
        numNextYear = numYear + 1
    End If

    If 0 Then
%>

<html>

<head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<meta name="generator" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Parish Calendar</title>
</head>

<body><%
    End If
%>

<form method=post action=calendar.asp name=frmCalendar>

<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
    <td align="left" bgcolor="#0033CC">&nbsp;<a
     href="calendar.asp?Month=<%=numPrevMonth%>&amp ;Year=<%=numPrevYear%>&amp;Day=0&amp;ParishID=<%=P arishID%>">&lt;&lt; Previous Month</a><br>
    </td>
    <td align="center" bgcolor="#0033CC"><b><%=MonthName(numMonth)%>, <%=numYear%></b></td>
    <td align="right" bgcolor="#0033CC"><a
     href="calendar.asp?Month=<%=numNextMonth%>&amp ;Year=<%=numNextYear%>&amp;Day=0&amp;ParishID=<%=P arishID%>">Next Month &gt;&gt;</a>&nbsp;<br>
    </td>
</tr>
</table>
<%
    If ParishID>0 Then
        SQL = "SELECT DISTINCT EventDate,EventType FROM Events"
        SQL = SQL & " WHERE EventDate>=#" & numMonth & "/1/" & numYear & "#"
        SQL = SQL & " AND EventDate<#" & numNextMonth & "/1/" & numNextYear & "#"
        SQL = SQL & " AND (ParishID=" & ParishID & " OR EXISTS(SELECT * FROM EventParishes WHERE Events.EventID=EventParishes.EventID AND EventParishes.ParishID=" & ParishID & "))"
        SQL = SQL & " ORDER BY EventDate,EventType"
    Else
        SQL = "SELECT DISTINCT EventDate,EventType FROM Events"
        SQL = SQL & " WHERE EventDate>=#" & numMonth & "/1/" & numYear & "#"
        SQL = SQL & " AND EventDate<#" & numNextMonth & "/1/" & numNextYear & "#"
        SQL = SQL & " AND List=True"
        SQL = SQL & " ORDER BY EventDate,EventType"
    End If
    rs.Open SQL, db, adOpenStatic, adLockReadOnly
%>
<table border="2" bordercolor="#000000" width="100%" cellpadding="0"
cellspacing="0">
<tr>
    <td>
     <table border="1" width="100%">
        <tr>
         <%
        For I = 1 to 7
         %>
         <th bgcolor="#000000" align="center"><b><%=WeekDayName(I)%></b>
            <%
        Next ' I
            %>
        </tr>
                     <%
        Offset = WeekDay(CDate(numMonth & "/1/" & numYear)) - 1
        For I = 1 to 6
            numDayShow = ((I-1) * 7) + 1 - Offset
            If I < 6 OR IsDate(numMonth & "/" & numDayShow & "/" & numYear) Then
                     %>
        <tr>
                        <%
                For J = 1 to 7
                    numDayShow = ((I-1) * 7) + J - Offset
                        %>
         <td align="right" width="10%" valign="top">"><%
                    If numDayShow>0 Then
                        If IsDate(numMonth & "/" & numDayShow & "/" & numYear) Then
                            dtShow = CDate(numMonth & "/" & numDayShow & "/" & numYear)
                            If numDay = numDayShow Then
                                Response.Write "<b>" & numDayShow & "</b>"
                            Else
                         %><a
            href="calendar.asp?Month=<%=numMonth%>&amp;Year=<% =numYear%>&amp;Day=<%=numDayShow%>&amp;ParishID=<% =ParishID%>"><%=numDayShow%></a><%
                            End If
            %><br>
            <%
                            bDone = False
                            bShown = False
                            While Not rs.EOF AND Not bDone
                                If DateDiff("d",dtShow,rs("EventDate"))=0 Then
                                    strShow = rs("EventType")
                                    If Len(strShow)>16 Then
                                        strShow = Left(strShow,15) & ".."
                                    End If
                                    strShow = Replace (strShow," ","&nbsp;")
                                    Response.Write strShow & "<br>"
                                    bShown = True
                                    rs.MoveNext
                                Else
                                    bDone = True
                                End If
                            Wend
                            If Not bShown Then
            %><br>
            <%
                            End If
            %><%
                        End If
                     End If
                         %></td>
                        <%
                Next ' J
                        %>
        </tr>
                     <%
            End If
        Next ' I
                     %>
     </table>
    </td>
</tr>
</table>
<%
    rs.Close
%>
<table width="100%">
<tr>
    <%
            For I = 1 to 12
    %>
    <td><%
                If I = numMonth Then
                    Response.Write "<b>" & MonthName(I) & "</b>"
                Else
     %>
     <a
     href="calendar.asp?Month=<%=I%>&amp;Year=<%=nu mYear%>&amp;Day=0&amp;ParishID=<%=ParishID%>"><%=M onthName(I)%></a>
     <%
                End If
     %>
     </td>
    <%
                If I = 6 Then
                    Response.Write "</tr><tr>"
                End If
            Next ' I
    %>
</tr>
</table>
<%
    If intFontSize = 1 Then
%>
<br>
<b><%=strDate%></b><br>
<%
    If ParishID>0 Then
        SQL = "SELECT * FROM Events"
        SQL = SQL & " WHERE EventDate=#" & numMonth & "/" & numDay & "/" & numYear & "#"
        SQL = SQL & " AND (ParishID=" & ParishID & " OR EXISTS(SELECT * FROM EventParishes WHERE Events.EventID=EventParishes.EventID AND EventParishes.ParishID=" & ParishID & "))"
        SQL = SQL & " ORDER BY EventDate,EventType"
    Else
        SQL = "SELECT * FROM Events"
        SQL = SQL & " WHERE EventDate=#" & numMonth & "/" & numDay & "/" & numYear & "#"
        SQL = SQL & " AND List=True"
        SQL = SQL & " ORDER BY EventDate,EventType"
    End If
        rs.Open SQL, db, adOpenStatic, adLockReadOnly
        If Not rs.EOF Then
%>
<table cellspacing="10" cellpadding="0" border="0">
<%
            While Not rs.EOF
                bAllDay = (rs("TimeStart") = 0) AND (rs("TimeEnd") = 0)
                If Not bAllDay Then
                    strStart = FormatDateTime(rs("TimeStart"),3)
                    strStart = Left(strStart,InStrRev(strStart,":")-1) & LCase(Right(strStart,2))
                    strEnd = FormatDateTime(rs("TimeEnd"),3)
                    strEnd = Left(strEnd,InStrRev(strEnd,":")-1) & LCase(Right(strEnd,2))
                End If
     %>
<tr>
    <%
                If bAllDay Then
    %>
    <td valign="top" nowrap><b>ALL DAY</b></td>
     <%
                Else
    %>
    <td valign="top" nowrap><b><%=strStart%></b><br>
     to&nbsp;<b><%=strEnd%></b></td>
     <%
                 End If
     %>
    <td valign="top"><%
                strLocation = rs("Location")
                If Len(strLocation)>0 Then
     %><%=rs("EventType")%> for <b><%=rs("Parish")%></b><br>
     at <b><%=strLocation%></b><br>
     <%
                Else
     %><%=rs("EventType")%> at <b><%=rs("Parish")%></b><br>
     <%
                End If
        %>
     <%=rs("SpeakerName")%>
     speaking on <i>&quot;<%=rs("TopicTitle")%>&quot;</i></td>
    <%
                If Authorized AND Admin Then
            %>
    <td align="right" valign="top"><a
     href="rep-form.asp?Submit=Edit&amp;EventID=<%=rs("EventID")% >"><b>EDIT</b></a></td>
    <%
    %>
</tr>
<%
                End If
                strNotes = rs("Notes")
                 If Len(strNotes)>0 Then
%>
<tr>
    <td>&nbsp;</td>
    <td colspan="2"><i><%=strNotes%></i></td>
</tr>
     <%
                 End If
                rs.MoveNext
            Wend
     %>
</table>
<%
        End If
        rs.Close
    End If
%>
<br>
<br>
<br>
<%
    If Authorized Then
%>Hi <%=Name%>, <a href="../cursillo/rep-form.asp">Add
Events Here</a><%
    Else
%>
Are you a Calendar Admin? <a href="login.asp">Add
Events Here</a>
<% End If
%>
</form>

<%
    DBClose

    If 0 Then
%>

</html>
<%
    End If
%>

Line 300 is the last End If and I can't seem to figure it out.

Thanks APD189





Similar Threads
Thread Thread Starter Forum Replies Last Post
error displaying asp page tanca Classic ASP Basics 5 November 28th, 2007 02:29 AM
error in asp page alirezaaali Classic ASP Databases 2 August 17th, 2006 12:18 AM
Asp page error hamed8esi Classic ASP Databases 2 March 8th, 2004 11:42 AM
Why my asp page error tamgo Classic ASP Databases 1 June 30th, 2003 03:32 AM





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