Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Database Error
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Database Error

 Post Reply Post Reply
Author
Tegwin View Drop Down
Senior Member
Senior Member


Joined: 03 September 2003
Location: United Kingdom
Status: Offline
Points: 430
Post Options Post Options   Thanks (0) Thanks(0)   Quote Tegwin Quote  Post ReplyReply Direct Link To This Post Topic: Database Error
    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
Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.