ERROR! [ODBC Microsoft Access Driver] Too few parameters. Expected 2.

M

Miranda

Hello, could somebody please help me figure this error out. I'm at my
wits end here. This is my connection & SQL statement:

<%@Language="Javascript" %>
<!--#include file="../../admin/adojavas.inc"-->

<%
var conn;
var rs;
var sSQL;

conn = Server.CreateObject("ADODB.connection");
conn.Open("cpWebdata");

sSQL = "SELECT InvestorId.Investors, MemberID.Investors ";
sSQL += " FROM Investors ";
sSQL += " WHERE InvestorId= '" + Request.Form("clientName") + "' ";
sSQL += " AND MemberID = '" + Request.Form("clientPass") + "' ";


THIS IS LINE 18 - > rs.Open(sSQL,conn);

Response.write(sSQL);

rs.close();
conn.close();
rs=null;
conn=null;

%>

And this is the error I am getting:
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected
2.
line 18.

The data it is checking is numeric, so I am wondering if there is an
issue with my quotes in my SQL statement?

Just in case it helps, here is the form:

<form name="f1" action="authorizeClienttest.asp" method="post"
onSubmit="return verify(f1);">

Client Login
Name:<input name="clientName" type="text" size="10" maxlength="10">
Password:<input name="clientPass" type="text" size="10"
maxlength="10">

<a href="#"><input type="image" src="images/loginSubmit.gif"
width="38" height="17" border="0" alt="Log In"></a>
</form>

Any help with this would be gratefully appreciated :)
Thanks in advance,
Cheers,
Miranda Johnsen
www.mirandajohnsen.com

******************************************************************
DEEP THOUGHTS...
"Every worthwhile accomplishment, big or little, has its stages of
drudgery and triumph; a beginning, a struggle and a victory."
Ghandi
********************************************************************
 
R

Ray at

It seems to me that you're mixing up your column and table names.

Try:
sSQL = "SELECT Investors.InvestorId, Investors.MemberID";
sSQL += " FROM Investors ";
sSQL += " WHERE InvestorId= '" + Request.Form("clientName") + "' ";
sSQL += " AND MemberID = '" + Request.Form("clientPass") + "' ";

Or just drop the Investors. part altogether since you're only querying one
table.

Also, if these values are numeric in your database, you don't want to
delimit them with '.

Ray at work
 
B

Bob Barrows

Miranda said:
Hello, could somebody please help me figure this error out. I'm at my
wits end here. This is my connection & SQL statement:

Actually, you did not show us your SQL statement. You showed us some
vbscript code that hopefully will result in a valid sql statement.

sSQL = "SELECT InvestorId.Investors, MemberID.Investors ";
sSQL += " FROM Investors ";
sSQL += " WHERE InvestorId= '" + Request.Form("clientName") + "' ";
sSQL += " AND MemberID = '" + Request.Form("clientPass") + "' ";


THIS IS LINE 18 - > rs.Open(sSQL,conn);

Response.write(sSQL);
Please show us the result of this statement. Comment out line 18 if you
have to. Actually look at it yourself and make sure it's a valid sql
statement that will run without modification when pasted into the
SQL View of the Access Query Builder.

I suggest you use & instead of + for your string concatenation operator.

Bob Barrows
PS. You should not be using ODBC. There is a perfectly fine native OLEDB
provider for Jet. See here for examples of connection strings using the Jet
OLEDB provider.
 
R

Ray at

In defense of Bob, he must have been in a rush, or he certainly would have
noticed that you're using jscript. Don't yell at him!

Ray at work
 
G

GVaught

One thing I noticed is that you declare var rs, but you don't open a
Recordset such as: rs=Server.CreateObject("ADODB.Recordset")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,740
Latest member
JudsonFrie

Latest Threads

Top