Print Page | Close Window

Database Error

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=6906
Printed Date: 31 March 2026 at 4:33pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Database Error
Posted By: Tegwin
Subject: Database Error
Date Posted: 01 November 2003 at 10:35am
I am new to ASP and I am learning  from a book I recently borrowed. I am having some problems with some of the code that is in the book, this is the code. Which is meant to search an access database, according to some values that get entered.


<HTML>
<BODY>
<%
if session("yes")=1 then
session("x")=request("keyword")
session("y")=request("cont")
session("yes")=2
end if
x=session("x")
y=session("y")

'Insertion point for part 2

 query ="select id,type, location, brief,verbose, email, wages from employ where (cont='"&y&"') and (type like '%"& x & "%' or location like '%"& x & "%' or brief like'%"& x & "%' or verbose like'%"& x & "%' or email like'%"& x & "%' or wages like '%"& x &"%')"
 
 set database=server.createObject("ADODB.Connection")
 database.open "jobs"

Set RSList=server.CreateObject("ADODB.recordset")
RSList.open query,database,3


dim numpages
dim currentpages

RSList.pagesize=10
if request.querystring("page")="" then
  currentpage=1
else
currentPage=CInt(request.querystring("page"))
end if
numpages =rslist.PageCount


If CurrentPage > numpages then currentPage = numpages
If currentPage < 1 then numpages =1
if numpages =0 then
%><CENTER><B><%
response.write "No jobs match your search criteria. Please try again"
%></br><BR><BR><A HREF="title.asp">Back to Search</A></center><%
respnse.end
end if


s="The search criteria you entered returned"

if y="yes" then
    n="contract"
else
    n="permanent"
End if

c=rslist.recordcount
s=s+" "+cstr(c)+" " +n+" "

if c<>1 then
 s=s+"jobs"
 elseif c=1 then
s=s+"job"

end if %><font color="blue"><%
response.write("<center>" +s)
RSList.AbsolutePage=currentpage
%>

<BR><HR>
<FONT SIZE="7" COLOR="blue"><B>
<table border=0 width=98% cellspacing=1>
<tr>
<th>Type</th>
<th>Location</th>
<th>Description</th>
<th>Wages</th>
</B>
</tr>
</FONT>

<%
dim numrows
numrows =0
do until rslist.eof or numrows >=RSlist.PageSize

aa=RSlist("type")
ab=RSList("location")
ac=RSlist("brief")
ad=RSList("wages")
%>


<tr>
<td><%=aa%></td>
<td><%=ab%></td>
<td><A HREF="jobdetails.asp?ID=<%=rslist("ID")%>"><%=ac %></a>
</td>
<td><%=ad%></td>

<%
 rslist.movenext
 numrows=numrows+1
 loop
 %>


</table>
<hr><br><CENTER>

<!-- Insertion part 4 -->


<% if currentpage>1 then %>
<A HREF="process.asp?page=<%=currentpage-1%>"> &nbsp;Previous Jobs</A>&nbsp;
<%
end if %>

<BR><BR>

<A HREF="title.asp">Back to search</A>

<%

rslist.close
set rslist=nothing
database.close
set database =nothing
%>
</center>
</BODY>
</HTML>



when I try and execute this page, which is being called from another page, when I enter a search criteria. I am getting the following output

Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 3.
/job/process.asp, line 20

Line 20 of the code is the highlighted one above which is : -
RSList.open query,database,3


What does this mean, and how do I correct it . I looked in google and there were some answers but they confused me even more

 

-------------
If you dont want my peaches, dont shake my tree



Replies:
Posted By: MorningZ
Date Posted: 01 November 2003 at 4:54pm

just try

RSList.open query,database

without the three.. because everything after the connection parameter (the second one) is optional and i believe if you define one, you have to define them all.. so just try without the third one first



-------------
Contribute to the working anarchy we fondly call the Internet



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net