Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > ERROR! [ODBC Microsoft Access Driver] Too few parameters. Expected 2.

Reply
Thread Tools

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

 
 
Miranda
Guest
Posts: n/a
 
      11-28-2003
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
************************************************** ******************
 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      11-28-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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);
>
>



 
Reply With Quote
 
 
 
 
Bob Barrows
Guest
Posts: n/a
 
      11-28-2003
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"


 
Reply With Quote
 
Aaron Bertrand [MVP]
Guest
Posts: n/a
 
      11-29-2003
> 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


 
Reply With Quote
 
Ray at
Guest
Posts: n/a
 
      11-29-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> Actually, you did not show us your SQL statement. You showed us some
> vbscript code that hopefully will result in a valid sql statement.
>



 
Reply With Quote
 
GVaught
Guest
Posts: n/a
 
      11-29-2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
> ************************************************** ******************



 
Reply With Quote
 
Bob Barrows
Guest
Posts: n/a
 
      11-29-2003
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"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Too few parameters. Expected 2 geletine Java 3 05-22-2006 05:46 PM
Too few parameters. Expected 1. isaac2004 ASP General 2 02-19-2006 09:47 AM
microsoft.public.dotnet.faqs,microsoft.public.dotnet.framework,microsoft.public.dotnet.framework.windowsforms,microsoft.public.dotnet.general,microsoft.public.dotnet.languages.vb Charles A. Lackman ASP .Net 1 12-08-2004 07:08 PM
Too few parameters. Expected 1. DVan ASP General 9 10-20-2004 08:36 PM
Too few parameters. Expected 1. - Problem with asp/access kbrad ASP General 8 09-29-2004 04:48 PM



Advertisments