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

Discussion in 'ASP General' started by Miranda, Nov 28, 2003.

  1. Miranda

    Miranda Guest

    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
    ********************************************************************
     
    Miranda, Nov 28, 2003
    #1
    1. Advertising

  2. Miranda

    Ray at Guest

    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" <> wrote in message
    news:...

    > 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);
    >
    >
     
    Ray at, Nov 28, 2003
    #2
    1. Advertising

  3. Miranda

    Bob Barrows Guest

    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"
     
    Bob Barrows, Nov 28, 2003
    #3
  4. Aaron Bertrand [MVP], Nov 29, 2003
    #4
  5. Miranda

    Ray at Guest

    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" <> wrote in message
    news:...
    >
    > Actually, you did not show us your SQL statement. You showed us some
    > vbscript code that hopefully will result in a valid sql statement.
    >
     
    Ray at, Nov 29, 2003
    #5
  6. Miranda

    GVaught Guest

    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" <> wrote in message
    news:...
    > 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
    > ********************************************************************
     
    GVaught, Nov 29, 2003
    #6
  7. Miranda

    Bob Barrows Guest

    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"
     
    Bob Barrows, Nov 29, 2003
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page