By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,664 Members | 1,592 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,664 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
************************************************** ******************
Jul 19 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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

"Miranda" <Mi*************@hotmail.com> wrote in message
news:5c**************************@posting.google.c om...
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);

Jul 19 '05 #2

P: n/a
Miranda wrote:
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.

<snip> 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.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #3

P: n/a
> 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.


http://www.connectionstrings.com/
http://www.aspfaq.com/2126
Jul 19 '05 #4

P: n/a
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

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:ei**************@TK2MSFTNGP11.phx.gbl...

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

Jul 19 '05 #5

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

"Miranda" <Mi*************@hotmail.com> wrote in message
news:5c**************************@posting.google.c om...
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
************************************************** ******************

Jul 19 '05 #6

P: n/a
Ray at <%=sLocation%> wrote:
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!

oops!

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Browse more ASP / Active Server Pages Questions on Bytes