Click to See Complete Forum and Search --> : Too few parameters


Squall Leonhart
11-18-2003, 06:43 PM
Hi, guys again:)

I have encountered error called "too few parameters".
What I have tried to do was using multiple recordset to get data from different tables in same database.
Please take a look at code.


<HTML>
<HEAD>
<TITLE>IT Request System</TITLE>
</HEAD>
<BODY LEFTMARGIN=0 MARGINWIDTH="0" MARGINHEIGHT="0">
<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsRequest 'Holds the recordset for the records in the database
Dim rsCategory1
Dim strSQL 'Holds the SQL query for the database
Dim strSQL1
Set adoCon = Server.CreateObject("ADODB.Connection")
Set rsRequest = Server.CreateObject("ADODB.Recordset")
Set rsCategory1 = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM tblRequest WHERE status= 1"
strSQL1 = "SELECT * FROM tblFAQ WHERE Category= A"
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("tech_re.mdb")
rsRequest.CursorType = 3
rsCategory1.CursorType = 3
rsRequest.Open strSQL, adoCon
rsCategory1.Open strSQL1, adoCon
%>
<TABLE BORDER=1 ALIGN=CENTER>
<TR>
<TD WIDTH=50%>
<table width=100%>
<TR>
<TD colspan=2 align=center><FONT FACE=Arial,Helvetica SIZE=2 color=blue><B>TOP 10 IT HOTLIST</b></font></td>
</tr>
<TR>
<TD colspan=2 align=center WIDTH=300><FONT FACE=Arial,Helvetica SIZE=-1 color=blue><i>Last modified: </i></font></td>
</tr>
<% Do while not rsRequest.eof %>
<TR>
<TD WIDTH="300" ALIGN=LEFT nowrap><FONT FACE=Arial,Helvetica SIZE=2 color=black><B><li><%=rsRequest("Description")%></li></B></FONT></TD>
</TR>
<% rsRequest.Movenext
Loop
%>
<TR>
<TD WIDTH="300" ALIGN=LEFT><FONT FACE=Arial,Helvetica SIZE=-1 color=red><B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="ITHotlist.xls" target=new>All IT Projects...</a></B></FONT></TD>
</TR>
</table>
</TD>

<td width=50% >
<table width=100%>
<TR>
<TD colspan=2 align=center><FONT FACE=Arial,Helvetica SIZE=2 color=blue><B>FAQs</b></font></td>
</TR>
<TR>
<TD colspan=2 ALIGN=CENTER WIDTH=300><FONT FACE=Arial,Helvetica SIZE=-1 color=blue><i>Last modified:</i></font></td>
</TR>
<% Do while not rsCategory1.eof %>
<TR>
<TD WIDTH="300" ALIGN=Center nowrap><FONT FACE=Arial,Helvetica SIZE=2 color=black><B><li><%=rsCategory1("Description")%></li></B></FONT></TD>
</TR>
<% rsCategory1.Movenext
Loop
%>
</table>
</td>
</tr>
</table>
<%'Reset server objects
rsRequest.Close
rsCategory1.Close
Set rsCategory1 = Nothing
Set rsRequest = Nothing
Set adoCon = Nothing
%>
</BODY>
</HTML>


It seems like error is here in this code

rsCategory1.Open strSQL1, adoCon

I don't see anything wrong :(
Do you guys can see anything wrong?
I will be waiting for reply. Thanks

slyfox
11-19-2003, 06:33 AM
strSQL1 = "SELECT * FROM tblFAQ WHERE Category= 'A'"

Squall Leonhart
11-19-2003, 11:10 AM
:) Thank you. Works now

slyfox
11-19-2003, 01:08 PM
my pleasure;)

CardboardHammer
11-24-2003, 02:06 AM
A couple of performance tips:

DON'T use SELECT *
DO SELECT only the columns you will use

DON'T access the columns by name
DO access them by index

Also, if you twist the things around a bit, you should be able to present all your data in an equivalent layout using only a single query/recordset.

And you can use CSS to cut down on the size of the resulting page.