Too few parameters to RecordSet.Open?

Discussion in 'ASP General' started by Robert Mark Bram, Oct 18, 2003.

  1. Hi All!

    My ASP page below receives the following error:

    Error Type:
    Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
    [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
    /polyprint/test.asp, line 31

    Line 31 is this line from below:
    newsletterText.open (sql);

    The sql statement works ok in Access and I have used the ConnectionString on
    other pages, so it works too. I have also used Open() in this way on other
    pages..

    I am a loss to know what other parameters are expected!

    Any advice would be welcome!

    Rob
    :)


    <%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
    <!--#include virtual="/adojavas.inc"-->
    <html><head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
    <body>
    <%
    /*
    This works ok!
    SELECT * FROM newsletterText
    WHERE pageName="1"
    and language="English"
    order by paragraph
    */
    var sql ="SELECT * FROM newsletterText " +
    "WHERE pageName=\"1\"" +
    " and language=\"English\" " +
    "order by paragraph";

    Response.Write( sql + "<br>");

    var polyprintConnection = Server.CreateObject ("ADODB.Connection");
    polyprintConnection.ConnectionString="DSN=PolyprintNewsletter";
    polyprintConnection.Open();

    var newsletterText = Server.CreateObject ("ADODB.Recordset");
    newsletterText.ActiveConnection = polyprintConnection;
    newsletterText.CursorType = adOpenForwardOnly;
    newsletterText.CursorLocation = adUseClient;
    newsletterText.LockType = adLockReadOnly;
    newsletterText.open (sql);
    %>
    </body>
    </html>
     
    Robert Mark Bram, Oct 18, 2003
    #1
    1. Advertising

  2. Looks like you might have misspelt the field names in your SQL, or they do
    not exist. Plus, the delimiter for a string is ' in SQL

    var sql ="SELECT * FROM newsletterText " +
    "WHERE pageName='1'" +
    " and language='English' " +
    "order by paragraph";

    --
    Manohar Kamath
    Editor, .netBooks
    www.dotnetbooks.com


    --
    Manohar Kamath
    Editor, .netBooks
    www.dotnetbooks.com


    "Robert Mark Bram" <> wrote in message
    news:3f908bb3$0$10617$...
    > Hi All!
    >
    > My ASP page below receives the following error:
    >
    > Error Type:
    > Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
    > [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 2.
    > /polyprint/test.asp, line 31
    >
    > Line 31 is this line from below:
    > newsletterText.open (sql);
    >
    > The sql statement works ok in Access and I have used the ConnectionString

    on
    > other pages, so it works too. I have also used Open() in this way on other
    > pages..
    >
    > I am a loss to know what other parameters are expected!
    >
    > Any advice would be welcome!
    >
    > Rob
    > :)
    >
    >
    > <%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
    > <!--#include virtual="/adojavas.inc"-->
    > <html><head>
    > <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    > </head>
    > <body>
    > <%
    > /*
    > This works ok!
    > SELECT * FROM newsletterText
    > WHERE pageName="1"
    > and language="English"
    > order by paragraph
    > */
    > var sql ="SELECT * FROM newsletterText " +
    > "WHERE pageName=\"1\"" +
    > " and language=\"English\" " +
    > "order by paragraph";
    >
    > Response.Write( sql + "<br>");
    >
    > var polyprintConnection = Server.CreateObject ("ADODB.Connection");
    > polyprintConnection.ConnectionString="DSN=PolyprintNewsletter";
    > polyprintConnection.Open();
    >
    > var newsletterText = Server.CreateObject ("ADODB.Recordset");
    > newsletterText.ActiveConnection = polyprintConnection;
    > newsletterText.CursorType = adOpenForwardOnly;
    > newsletterText.CursorLocation = adUseClient;
    > newsletterText.LockType = adLockReadOnly;
    > newsletterText.open (sql);
    > %>
    > </body>
    > </html>
    >
    >
     
    Manohar Kamath [MVP], Oct 18, 2003
    #2
    1. Advertising

  3. Ah ha!
    Thank you Manohar, I was using the wrong delimiter!

    Rob
    :)
     
    Robert Mark Bram, Oct 18, 2003
    #3
    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.
Similar Threads
  1. Aaron B.
    Replies:
    2
    Views:
    6,524
    Erich Reimberg N.
    Nov 23, 2004
  2. geletine

    Too few parameters. Expected 2

    geletine, May 21, 2006, in forum: Java
    Replies:
    3
    Views:
    7,806
    geletine
    May 22, 2006
  3. Trey Guy
    Replies:
    5
    Views:
    135
    Mark Schupp
    Jul 7, 2003
  4. Miranda
    Replies:
    6
    Views:
    316
    Bob Barrows
    Nov 29, 2003
  5. kbrad
    Replies:
    8
    Views:
    182
    Aaron [SQL Server MVP]
    Sep 29, 2004
Loading...

Share This Page