Too few parameters to RecordSet.Open?

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Too few parameters to RecordSet.Open?

    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=Polyprin tNewsletter";
    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 Guest

  2. Similar Questions and Discussions

    1. Open parameters do not work
      The open parameters specified in URL (e.g. <http://partners.adobe.com/asn/acrobat/sdk/public/docs/PDFOpenParams.pdf#page=6)> do not work (neither in...
    2. using Command to set Parameters and Recordset to retrive the Query
      Hi guys, withou using SP, I want to be able to add a Parameter to the SQL Query and retrive the Recordset so I can use the Paging property under...
    3. ADO recordset open method - pagecount -1
      Hi I have used ADO recordset open method on a ASP page for the sql command string its a name of a Stored Proc as follows Set conn =...
    4. objRS.Open parameters
      Are the values of adOpenForwardOnly and adLockOptimistic assigned automatically on the server or should I be preloading these with their numeric...
    5. new to asp and ado from dao and vb, can't open mdb/recordset
      It's got nothing to do with your connection string. An asp pabe knows nothing about the ADO constants (adOpenDynamic, etc.) unless you tell it...
  3. #2

    Default Re: Too few parameters to RecordSet.Open?

    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
    [url]www.dotnetbooks.com[/url]


    --
    Manohar Kamath
    Editor, .netBooks
    [url]www.dotnetbooks.com[/url]


    "Robert Mark Bram" <relaxedrob@removethis.optushome.com.au> wrote in message
    news:3f908bb3$0$10617$afc38c87@news.optusnet.com.a u...
    > 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=Polyprin tNewsletter";
    > 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] Guest

  4. #3

    Default Re: Too few parameters to RecordSet.Open?

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

    Rob
    :)


    Robert Mark Bram Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139