Can someone please tell me why I am getting:
"too few parameters expected 1" error?
This works on my local machine but when I uploaded it to the web, I started getting that error:
Here is the code:
The error is on this line:
sqlstmt = "SELECT * from Guestbook1 ORDER BY PostDate DESC"
Set rs = Server.CreateObject("ADODB.Recordset"
rs.Open sqlstmt, conn, 3, 3
TotalRecs = rs.recordcount
rs.Pagesize=10
<html>
<head>
<title>Sing Our Guestbook</title>
<meta http-equiv="expires" content="0">
<style>
<!--
a:link, a:visited {color:#FFFFFF; font-weight:bold;}
a:active {color=yellow; background: firebrick; font-size: 100%; font-weight:bold;}
a:hover {color:yellow; font-weight:bold;}
//-->
</style>
</head>
<body bgcolor="#527F76" text="#FFFFFF" topmargin=0 leftmargin=0>
<br>
<center>
<font face="times new roman">
<h1><i>Our Guestbook
<HR SIZE=1 WIDTH="90%" color="#FF7F00"></i></h1><p>
</font>
<% PageNo = request("page"
If PageNo="" then
%>
<font face="arial" size=3>
<a href="sign.asp">Sign Our Guestbook</a>
<a href="<%= Request.ServerVariables("HTTP_REFERER"
%>">Back to Referring Page</a>
</font>
<%
PageNo=1
ElseIf PageNo=1 then
%>
<font face="arial" size=3>
<a href="sign.asp">Sign the Guestbook</a>
<%
Else
%>
<p>
<%
End If
set conn = server.createobject("adodb.connection"
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
' set the actual path to the guestbook below - this example
' assumes that the guestbook is in the web server root
DSNtemp=dsntemp & "DBQ=" & server.mappath("\samosa\db\guestbook1.mdb"
conn.Open DSNtemp
sqlstmt = "SELECT * from Guestbook1 ORDER BY PostDate DESC"
Set rs = Server.CreateObject("ADODB.Recordset"
rs.Open sqlstmt, conn, 3, 3
TotalRecs = rs.recordcount
rs.Pagesize=10
TotalPages = cInt(rs.pagecount)
rs.absolutepage=PageNo
If PageNo = 1 then
response.write "<br><Font face='arial' size=2>There are " & TotalRecs & " entries in " & TotalPages & " pages</font>"
End If
If rs.eof then
response.write "<p><br><center><font face='arial'><b>There are no entries in the guestbook.</b>"
response.write "<br><a href='sign.asp'>Sign the Guestbook</a></font></center>"
response.end
End If
x = 0
For x = 1 to 10
If rs.eof then
Exit For
Else
When = rs("PostDate"
FirstName = rs("FirstName"
FirstName = Replace(FirstName,"''","'"
LastName = rs("LastName"
LastName = Replace(LastName,"''","'"
City = rs("City"
State = rs("State"
Country = rs("Country"
Email = rs("Email"
URL = rs("URL"
If IsEmpty(URL) or URL = "" then
Link = "no URL given"
Else
Link = "<a href='" & URL & "'>" & URL & "</a>"
End If
Comments = rs("Comments"
Comments = replace(Comments, "''", "'"
Start = rs("PostDate"
%>
<table width=600 border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=3><font face="arial" size=2><%= When %></td></tr>
<tr>
<td colspan=3 bgcolor="#C5BE60"><font face="arial" size=2 color="#000000">
<b><%= Comments %></b></font>
</td>
</tr>
<tr>
<td width=125 valign="top">
<font face="arial" size=1>
<%
If IsEmpty(Email) or Email="" then
response.write(FirstName)
response.write(LastName)
Else
response.write "<a href='mailto:" & Email & "'>" & FirstName & " "& LastName & " </a>"
End If
%>
</font>
</td>
<td width=200 valign="top"><font face="arial" size=1><i><%= City %>
<%= State %> <%= Country %></i>
</td>
<td width=275 align="right" valign="top">
<font face="arial" size=1><%= Link %>
</font>
</td>
</tr>
</table>
<br>
<%
rs.MoveNext
End If
Next
response.write "<table width=300 border=0><tr>"
response.write "<td align='center'>"
If PageNo > 1 then
response.write "<form method='post' action='guestbook1.asp'>"
response.write "<input type='hidden' name='Page' value='" & PageNo-1 & "'>"
response.write "<font face='arial' size=2>"
response.write "<input type='submit' value='<< Prev'></form>"
Else
response.write " "
End If
response.write "</td><td align='center'>"
If NOT rs.eof then
response.write "<form method='post' action='guestbook1.asp'>"
response.write "<input type='hidden' name='Page' value='" & PageNo+1 & "'>"
response.write "<font face='arial' size=2>"
response.write "<input type='submit' value='Next >>'></form>"
Else
response.write " "
End If
response.write "</td></tr></table>"
conn.close
set conn = nothing
%>
</center>
</body>
</html>
"too few parameters expected 1" error?
This works on my local machine but when I uploaded it to the web, I started getting that error:
Here is the code:
The error is on this line:
sqlstmt = "SELECT * from Guestbook1 ORDER BY PostDate DESC"
Set rs = Server.CreateObject("ADODB.Recordset"
rs.Open sqlstmt, conn, 3, 3
TotalRecs = rs.recordcount
rs.Pagesize=10
<html>
<head>
<title>Sing Our Guestbook</title>
<meta http-equiv="expires" content="0">
<style>
<!--
a:link, a:visited {color:#FFFFFF; font-weight:bold;}
a:active {color=yellow; background: firebrick; font-size: 100%; font-weight:bold;}
a:hover {color:yellow; font-weight:bold;}
//-->
</style>
</head>
<body bgcolor="#527F76" text="#FFFFFF" topmargin=0 leftmargin=0>
<br>
<center>
<font face="times new roman">
<h1><i>Our Guestbook
<HR SIZE=1 WIDTH="90%" color="#FF7F00"></i></h1><p>
</font>
<% PageNo = request("page"
If PageNo="" then
%>
<font face="arial" size=3>
<a href="sign.asp">Sign Our Guestbook</a>
<a href="<%= Request.ServerVariables("HTTP_REFERER"
</font>
<%
PageNo=1
ElseIf PageNo=1 then
%>
<font face="arial" size=3>
<a href="sign.asp">Sign the Guestbook</a>
<%
Else
%>
<p>
<%
End If
set conn = server.createobject("adodb.connection"
DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)}; "
' set the actual path to the guestbook below - this example
' assumes that the guestbook is in the web server root
DSNtemp=dsntemp & "DBQ=" & server.mappath("\samosa\db\guestbook1.mdb"
conn.Open DSNtemp
sqlstmt = "SELECT * from Guestbook1 ORDER BY PostDate DESC"
Set rs = Server.CreateObject("ADODB.Recordset"
rs.Open sqlstmt, conn, 3, 3
TotalRecs = rs.recordcount
rs.Pagesize=10
TotalPages = cInt(rs.pagecount)
rs.absolutepage=PageNo
If PageNo = 1 then
response.write "<br><Font face='arial' size=2>There are " & TotalRecs & " entries in " & TotalPages & " pages</font>"
End If
If rs.eof then
response.write "<p><br><center><font face='arial'><b>There are no entries in the guestbook.</b>"
response.write "<br><a href='sign.asp'>Sign the Guestbook</a></font></center>"
response.end
End If
x = 0
For x = 1 to 10
If rs.eof then
Exit For
Else
When = rs("PostDate"
FirstName = rs("FirstName"
FirstName = Replace(FirstName,"''","'"
LastName = rs("LastName"
LastName = Replace(LastName,"''","'"
City = rs("City"
State = rs("State"
Country = rs("Country"
Email = rs("Email"
URL = rs("URL"
If IsEmpty(URL) or URL = "" then
Link = "no URL given"
Else
Link = "<a href='" & URL & "'>" & URL & "</a>"
End If
Comments = rs("Comments"
Comments = replace(Comments, "''", "'"
Start = rs("PostDate"
%>
<table width=600 border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=3><font face="arial" size=2><%= When %></td></tr>
<tr>
<td colspan=3 bgcolor="#C5BE60"><font face="arial" size=2 color="#000000">
<b><%= Comments %></b></font>
</td>
</tr>
<tr>
<td width=125 valign="top">
<font face="arial" size=1>
<%
If IsEmpty(Email) or Email="" then
response.write(FirstName)
response.write(LastName)
Else
response.write "<a href='mailto:" & Email & "'>" & FirstName & " "& LastName & " </a>"
End If
%>
</font>
</td>
<td width=200 valign="top"><font face="arial" size=1><i><%= City %>
<%= State %> <%= Country %></i>
</td>
<td width=275 align="right" valign="top">
<font face="arial" size=1><%= Link %>
</font>
</td>
</tr>
</table>
<br>
<%
rs.MoveNext
End If
Next
response.write "<table width=300 border=0><tr>"
response.write "<td align='center'>"
If PageNo > 1 then
response.write "<form method='post' action='guestbook1.asp'>"
response.write "<input type='hidden' name='Page' value='" & PageNo-1 & "'>"
response.write "<font face='arial' size=2>"
response.write "<input type='submit' value='<< Prev'></form>"
Else
response.write " "
End If
response.write "</td><td align='center'>"
If NOT rs.eof then
response.write "<form method='post' action='guestbook1.asp'>"
response.write "<input type='hidden' name='Page' value='" & PageNo+1 & "'>"
response.write "<font face='arial' size=2>"
response.write "<input type='submit' value='Next >>'></form>"
Else
response.write " "
End If
response.write "</td></tr></table>"
conn.close
set conn = nothing
%>
</center>
</body>
</html>