CLSTEAM
asked on
ASP Error: Microsoft VBScript compilation (0x800A0400) Expected statement
I get the following error:
Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/employees/test/calendar.a sp, line 10
This is the code:
<%
public dbConn, dbRs
Set dbConn = Server.CreateObject("ADODB .Connectio n")
Set dbRs = Server.CreateObject ("ADODB.Recordset")
dbConn.Mode = adModeReadWrite
dbConn.ConnectionString = "DSN=******;UID=css;PWD=*; "
dbConn.Open
' force declaration of all variables
Option Explicit <--- THIS IS LINE 10
Dim intYear, intMonth, intDay
Dim intNumberOfDays, strDaysInMonths
Dim strDate, strMonthName
Dim strStyle, strTitle
Dim strMethod, strURL
Dim strFirstDay, strLastDay, strCurrentDay
Dim dtmPrev, dtmNext
Dim X,Y,Z
' find out the URL of the page and the HTTP method used
strMethod = UCase(Request.ServerVariab les("REQUE ST_METHOD" ))
strURL = LCase(Request.ServerVariab les("URL") )
' if it's a GET then it's a regular browser request
If strMethod="GET" Then
' use today's date
intDay = CInt(Day(Date()))
intMonth = CInt(Month(Date()))
intYear = CInt(Year(Date()))
strFirstDay = CStr(intMonth) & "-1-" & CStr(intYear)
strDate = CStr(intMonth) & "-" & CStr(intDay) & "-" & CStr(intYear)
' if it's a POST then it's a specific request
Else
' get the submitted date
intDay = CInt(Day(Date()))
intMonth = CInt(Request.Form("txtMont h"))
intYear = CInt(Request.Form("txtYear "))
strFirstDay = CStr(intMonth) & "-1-" & CStr(intYear)
strDate = strFirstDay
End If
' is a date in a leap year?
Function IsLeapYearDate(dtmTestDate )
IsLeapYearDate = False
If IsDate(dtmTestDate) Then
Dim dtmTempDate
dtmTempDate = "1/31/" & Year(dtmTestDate)
dtmTempDate = DateAdd("m", 1, dtmTempDate)
If Day(dtmTempDate) = 29 Then IsLeapYearDate = True
End If
End Function
' create string of days in months
If IsLeapYearDate("1/1/" & intYear) Then
strDaysInMonths = "312931303130313130313031"
Else
strDaysInMonths = "312831303130313130313031"
End If
' get some date stuff
strMonthName = CStr(MonthName(intMonth))
intNumberOfDays = CInt(Mid(strDaysInMonths,( (intMonth- 1)*2)+1,2) )
strLastDay = CStr(intMonth) & "-" & intNumberOfDays & "-" & CStr(intYear)
' build the page title
strTitle = "CSS Marketing Calendar for " & strMonthName & " " & intYear
' get the next and previous months for the menus
dtmPrev = CDate(DateAdd("m", -1, strDate))
dtmNext = CDate(DateAdd("m", 1, strDate))
%>
<html>
<head>
<title><%=strTitle%></titl e>
</head>
<body>
<h1 align="center"><%=strTitle %></h1>
<center>
<table border="0" width="1235">
<tr>
<td align="left">
<form action="<%=strURL%>" method="POST">
<input type="hidden" name="txtMonth" value="<%=Month(dtmPrev)%> ">
<input type="hidden" name="txtYear" value="<%=Year(dtmPrev)%>" >
<input type="submit" style="width:150" value="View <%=MonthName(Month(dtmPrev ))%>">
</form>
</td>
<% If (intMonth <> Month(Date())) Or (intYear <> Year(Date())) Then %>
<td align="center">
<form action="<%=strURL%>" method="POST">
<input type="hidden" name="txtMonth" value="<%=Month(Date())%>" >
<input type="hidden" name="txtYear" value="<%=Year(Date())%>">
<input type="submit" style="width:150" value="View Current Month">
</form>
</td>
<% End If %>
<td align="right">
<form action="<%=strURL%>" method="POST">
<input type="hidden" name="txtMonth" value="<%=Month(dtmNext)%> ">
<input type="hidden" name="txtYear" value="<%=Year(dtmNext)%>" >
<input type="submit" style="width:150" value="View <%=MonthName(Month(dtmNext ))%>">
</form>
</td>
</tr>
</table>
</center>
<table border="1" cellpadding="2" cellspacing="0" width="1235">
<tr>
<%
' print the weekday names
For X = 1 to 7
Response.Write "<th width=""14%"">" & WeekdayName(X) & "</th>" & vbCrLf
Next
%>
</tr>
<tr>
<%
' print empty table cells for the beginning days not in the current month
If (Weekday(strFirstDay)-1) Then
For X = 1 to (Weekday(strFirstDay)-1)
Response.Write "<td bgcolor='#dddddd'> </ td>" & vbCrLf
Next
End If
' loop through the days in the current month
For X = 1 to intNumberOfDays
' get the day we're working on
strCurrentDay = CStr(intMonth) & "-" & X & "-" & CStr(intYear)
' start the table cell for a day
Response.Write "<td id=""" & X & """ align=""left"" valign=""top"" height='75'>"
Response.Write "<a href=viewday.asp?d="&X&"&m ="&intMont h&"&y="&in tYear&">" & X & "</a><br>" & vbCrLf
' end the table cell for a day
Response.Write "</td>" & vbCrLf
' if the current day is then end of a week then output the end of the table row
If (Weekday(strCurrentDay) = 7) And (strCurrentDay <> strLastDay) Then
Response.Write "</tr>" & vbCrLf & "<tr>" & vbCrLf
End If
Next
' print empty table cells for the ending days not in the current month
If (7-Weekday(strLastDay)) Then
For X = 1 to (7-Weekday(strLastDay))
Response.Write "<td bgcolor='#dddddd' height='75'> </td>" & vbCrLf
Next
End If
%>
</tr>
</table>
</body>
</html>
I obtained this code from a microsoft website. The code works fine without the first few lines before line 10. The DB lines are the ones I successfully use on all the other webpages in the same server. I don't know what the problem is here. As you can see, I'm pretty new at ASP. Thanks for the help!
Error Type:
Microsoft VBScript compilation (0x800A0400)
Expected statement
/employees/test/calendar.a
This is the code:
<%
public dbConn, dbRs
Set dbConn = Server.CreateObject("ADODB
Set dbRs = Server.CreateObject ("ADODB.Recordset")
dbConn.Mode = adModeReadWrite
dbConn.ConnectionString = "DSN=******;UID=css;PWD=*;
dbConn.Open
' force declaration of all variables
Option Explicit <--- THIS IS LINE 10
Dim intYear, intMonth, intDay
Dim intNumberOfDays, strDaysInMonths
Dim strDate, strMonthName
Dim strStyle, strTitle
Dim strMethod, strURL
Dim strFirstDay, strLastDay, strCurrentDay
Dim dtmPrev, dtmNext
Dim X,Y,Z
' find out the URL of the page and the HTTP method used
strMethod = UCase(Request.ServerVariab
strURL = LCase(Request.ServerVariab
' if it's a GET then it's a regular browser request
If strMethod="GET" Then
' use today's date
intDay = CInt(Day(Date()))
intMonth = CInt(Month(Date()))
intYear = CInt(Year(Date()))
strFirstDay = CStr(intMonth) & "-1-" & CStr(intYear)
strDate = CStr(intMonth) & "-" & CStr(intDay) & "-" & CStr(intYear)
' if it's a POST then it's a specific request
Else
' get the submitted date
intDay = CInt(Day(Date()))
intMonth = CInt(Request.Form("txtMont
intYear = CInt(Request.Form("txtYear
strFirstDay = CStr(intMonth) & "-1-" & CStr(intYear)
strDate = strFirstDay
End If
' is a date in a leap year?
Function IsLeapYearDate(dtmTestDate
IsLeapYearDate = False
If IsDate(dtmTestDate) Then
Dim dtmTempDate
dtmTempDate = "1/31/" & Year(dtmTestDate)
dtmTempDate = DateAdd("m", 1, dtmTempDate)
If Day(dtmTempDate) = 29 Then IsLeapYearDate = True
End If
End Function
' create string of days in months
If IsLeapYearDate("1/1/" & intYear) Then
strDaysInMonths = "312931303130313130313031"
Else
strDaysInMonths = "312831303130313130313031"
End If
' get some date stuff
strMonthName = CStr(MonthName(intMonth))
intNumberOfDays = CInt(Mid(strDaysInMonths,(
strLastDay = CStr(intMonth) & "-" & intNumberOfDays & "-" & CStr(intYear)
' build the page title
strTitle = "CSS Marketing Calendar for " & strMonthName & " " & intYear
' get the next and previous months for the menus
dtmPrev = CDate(DateAdd("m", -1, strDate))
dtmNext = CDate(DateAdd("m", 1, strDate))
%>
<html>
<head>
<title><%=strTitle%></titl
</head>
<body>
<h1 align="center"><%=strTitle
<center>
<table border="0" width="1235">
<tr>
<td align="left">
<form action="<%=strURL%>" method="POST">
<input type="hidden" name="txtMonth" value="<%=Month(dtmPrev)%>
<input type="hidden" name="txtYear" value="<%=Year(dtmPrev)%>"
<input type="submit" style="width:150" value="View <%=MonthName(Month(dtmPrev
</form>
</td>
<% If (intMonth <> Month(Date())) Or (intYear <> Year(Date())) Then %>
<td align="center">
<form action="<%=strURL%>" method="POST">
<input type="hidden" name="txtMonth" value="<%=Month(Date())%>"
<input type="hidden" name="txtYear" value="<%=Year(Date())%>">
<input type="submit" style="width:150" value="View Current Month">
</form>
</td>
<% End If %>
<td align="right">
<form action="<%=strURL%>" method="POST">
<input type="hidden" name="txtMonth" value="<%=Month(dtmNext)%>
<input type="hidden" name="txtYear" value="<%=Year(dtmNext)%>"
<input type="submit" style="width:150" value="View <%=MonthName(Month(dtmNext
</form>
</td>
</tr>
</table>
</center>
<table border="1" cellpadding="2" cellspacing="0" width="1235">
<tr>
<%
' print the weekday names
For X = 1 to 7
Response.Write "<th width=""14%"">" & WeekdayName(X) & "</th>" & vbCrLf
Next
%>
</tr>
<tr>
<%
' print empty table cells for the beginning days not in the current month
If (Weekday(strFirstDay)-1) Then
For X = 1 to (Weekday(strFirstDay)-1)
Response.Write "<td bgcolor='#dddddd'> </
Next
End If
' loop through the days in the current month
For X = 1 to intNumberOfDays
' get the day we're working on
strCurrentDay = CStr(intMonth) & "-" & X & "-" & CStr(intYear)
' start the table cell for a day
Response.Write "<td id=""" & X & """ align=""left"" valign=""top"" height='75'>"
Response.Write "<a href=viewday.asp?d="&X&"&m
' end the table cell for a day
Response.Write "</td>" & vbCrLf
' if the current day is then end of a week then output the end of the table row
If (Weekday(strCurrentDay) = 7) And (strCurrentDay <> strLastDay) Then
Response.Write "</tr>" & vbCrLf & "<tr>" & vbCrLf
End If
Next
' print empty table cells for the ending days not in the current month
If (7-Weekday(strLastDay)) Then
For X = 1 to (7-Weekday(strLastDay))
Response.Write "<td bgcolor='#dddddd' height='75'> </td>" & vbCrLf
Next
End If
%>
</tr>
</table>
</body>
</html>
I obtained this code from a microsoft website. The code works fine without the first few lines before line 10. The DB lines are the ones I successfully use on all the other webpages in the same server. I don't know what the problem is here. As you can see, I'm pretty new at ASP. Thanks for the help!
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Thanks guys! Working now. I wish I could have a red phone going straight to you guys!
Thanks for accepting.
<At the same time testing "Open for Discussion" new EE feature>
<At the same time testing "Open for Discussion" new EE feature>
ASKER
Error Type:
Microsoft VBScript runtime (0x800A01F4)
Variable is undefined: 'adModeReadWrite'
/employees/test/calendar.a
Thanks!