Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can you tell me why.....

Status
Not open for further replies.

samosa

Technical User
Jul 15, 2005
38
0
0
IT
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=&quot;expires&quot; content=&quot;0&quot;>
<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=&quot;#527F76&quot; text=&quot;#FFFFFF&quot; topmargin=0 leftmargin=0>
<br>
<center>
<font face=&quot;times new roman&quot;>
<h1><i>Our Guestbook
<HR SIZE=1 WIDTH=&quot;90%&quot; color=&quot;#FF7F00&quot;></i></h1><p>&nbsp;
</font>
<% PageNo = request(&quot;page&quot;)
If PageNo=&quot;&quot; then
%>
<font face=&quot;arial&quot; size=3>
<a href=&quot;sign.asp&quot;>Sign Our Guestbook</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href=&quot;<%= Request.ServerVariables(&quot;HTTP_REFERER&quot;)%>&quot;>Back to Referring Page</a>
</font>
<%
PageNo=1
ElseIf PageNo=1 then
%>
<font face=&quot;arial&quot; size=3>
<a href=&quot;sign.asp&quot;>Sign the Guestbook</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%
Else
%>
<p>

<%
End If
set conn = server.createobject(&quot;adodb.connection&quot;)
DSNtemp=&quot;DRIVER={Microsoft Access Driver (*.mdb)}; &quot;
' set the actual path to the guestbook below - this example
' assumes that the guestbook is in the web server root
DSNtemp=dsntemp & &quot;DBQ=&quot; & server.mappath(&quot;\samosa\db\guestbook1.mdb&quot;)
conn.Open DSNtemp
sqlstmt = &quot;SELECT * from Guestbook1 ORDER BY PostDate DESC&quot;
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)
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 &quot;<br><Font face='arial' size=2>There are &quot; & TotalRecs & &quot; entries in &quot; & TotalPages & &quot; pages</font>&quot;
End If

If rs.eof then
response.write &quot;<p><br><center><font face='arial'><b>There are no entries in the guestbook.</b>&quot;
response.write &quot;<br><a href='sign.asp'>Sign the Guestbook</a></font></center>&quot;
response.end
End If
x = 0
For x = 1 to 10
If rs.eof then
Exit For
Else
When = rs(&quot;PostDate&quot;)
FirstName = rs(&quot;FirstName&quot;)
FirstName = Replace(FirstName,&quot;''&quot;,&quot;'&quot;)
LastName = rs(&quot;LastName&quot;)
LastName = Replace(LastName,&quot;''&quot;,&quot;'&quot;)
City = rs(&quot;City&quot;)
State = rs(&quot;State&quot;)
Country = rs(&quot;Country&quot;)
Email = rs(&quot;Email&quot;)
URL = rs(&quot;URL&quot;)
If IsEmpty(URL) or URL = &quot;&quot; then
Link = &quot;no URL given&quot;
Else
Link = &quot;<a href='&quot; & URL & &quot;'>&quot; & URL & &quot;</a>&quot;
End If
Comments = rs(&quot;Comments&quot;)
Comments = replace(Comments, &quot;''&quot;, &quot;'&quot;)
Start = rs(&quot;PostDate&quot;)
%>
<table width=600 border=0 cellpadding=0 cellspacing=0>
<tr><td colspan=3><font face=&quot;arial&quot; size=2><%= When %></td></tr>

<tr>
<td colspan=3 bgcolor=&quot;#C5BE60&quot;><font face=&quot;arial&quot; size=2 color=&quot;#000000&quot;>
<b><%= Comments %></b></font>
</td>
</tr>

<tr>
<td width=125 valign=&quot;top&quot;>
<font face=&quot;arial&quot; size=1>
<%
If IsEmpty(Email) or Email=&quot;&quot; then
response.write(FirstName)
response.write(LastName)
Else
response.write &quot;<a href='mailto:&quot; & Email & &quot;'>&quot; & FirstName & &quot; &quot;& LastName & &quot; </a>&quot;
End If
%>
</font>
</td>

<td width=200 valign=&quot;top&quot;><font face=&quot;arial&quot; size=1><i><%= City %>&nbsp;
<%= State %>&nbsp;<%= Country %></i>
</td>

<td width=275 align=&quot;right&quot; valign=&quot;top&quot;>
<font face=&quot;arial&quot; size=1><%= Link %>
</font>
</td>
</tr>
</table>
<br>
<%
rs.MoveNext
End If
Next
response.write &quot;<table width=300 border=0><tr>&quot;
response.write &quot;<td align='center'>&quot;
If PageNo > 1 then
response.write &quot;<form method='post' action='guestbook1.asp'>&quot;
response.write &quot;<input type='hidden' name='Page' value='&quot; & PageNo-1 & &quot;'>&quot;
response.write &quot;<font face='arial' size=2>&quot;
response.write &quot;<input type='submit' value='<< Prev'></form>&quot;
Else
response.write &quot;&nbsp;&quot;
End If
response.write &quot;</td><td align='center'>&quot;
If NOT rs.eof then
response.write &quot;<form method='post' action='guestbook1.asp'>&quot;
response.write &quot;<input type='hidden' name='Page' value='&quot; & PageNo+1 & &quot;'>&quot;
response.write &quot;<font face='arial' size=2>&quot;
response.write &quot;<input type='submit' value='Next >>'></form>&quot;
Else
response.write &quot;&nbsp;&quot;
End If
response.write &quot;</td></tr></table>&quot;
conn.close
set conn = nothing
%>
</center>
</body>
</html>
 
Try Converting PageNo to a integer CInt(PageNo)
 
I have resolved it.
I left out (stupid me) one field from the table.
thanks for your time and input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top