Results 1 to 2 of 2

Thread: Too Few Parameters

  1. #1
    Adam P. Guest

    Too Few Parameters

    I am trying to search an access database using vbscript.
    I am writing my code in front page 98.
    The query gets it's parameters from a text box and a selection list.
    The query works if the user inputs something into the text box and the selection list.
    It even works if something is chosen from the selection list and the text box is left empty.
    If someone enters something into the text box,
    and does not choose something from the selection list I get this error:

    Microsoft OLE DB Provider for ODBC Drivers error '80040e10'

    [Microsoft][ODBC Microsoft Access 97 Driver] Too few parameters. Expected 1.

    Here is my code:

    <html>
    <!--#INCLUDE FILE= CkflgStore.inc -->
    <!--#INCLUDE FILE= adovbs.inc -->
    <!--#include file= RecToTable.asp-->
    <!--#include file= ListBox.asp-->

    <head>
    <meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=iso-8859-1&#34;>
    <title>Search</title>
    </head>

    <body>
    <%
    Dim objRecSeries &#39;Recordset to produce selection list on form
    Dim objRec &#39;Recordset Produced by Query
    Dim strDriver &#39;Parameter: Contents of textbox on form
    Dim strSeries &#39;Parameter: Contents of selection list on form
    Dim objCommand &#39;Command to Produce objRec
    Dim strSql &#39;SQL String

    strDriver= Request.form(&#34;Driver&#34
    strSeries= Request.Form(&#34;series&#34

    set objRecSeries= Server.CreateObject (&#34;ADODB.Recordset&#34
    objRecSeries.open &#34;tblSeries&#34;,strconn,adOpenDynamic,adLockRe adOnly,adCmdTable

    &#39;This include file is a function that makes a txtBox and Selection list
    response.write ListBox (objRecSeries)

    strSql=&#34;SELECT * FROM tblCollectible &#34;

    &#39;build SQL statement according to what user chooses
    &#39; &#34;Choose a Series&#34; is the default for Selection List and means nothing was &#39;chosen
    if strSeries = &#34;Choose a Series&#34; then
    if strDriver <> &#34;&#34; then
    strSql= strSql & &#34; WHERE strDriver= &#39;&#34;&strDriver&&#34;&#39; &#34;
    else
    Response.write &#34;<center><h2>Please Specify Search Criteria</h2></center>&#34;
    end if
    else
    if strDriver <> &#34;&#34; then
    strSql= strSql & &#34; WHERE Driver= &#39;&#34;&strDriver&&#34;&#39; and SeriesName=&#39;&#34;&strSeries&&#34;&#39;&#34;
    else
    strSql= strSql & &#34; WHERE SeriesName= &#39;&#34;&strSeries&&#34;&#39; &#34;
    end if
    end if

    &#39;Create Command
    Set objCommand= Server.CreateObject (&#34;ADODB.Command&#34
    objCommand.ActiveConnection= strConn
    objCommand.CommandText= strSql
    objCommand.CommandType= adCmdText

    &#39;Create recordset to be displayed
    Set objRec=Server.createobject (&#34;ADODB.Recordset&#34
    set objRec= objCommand.Execute

    &#39;call function to write data to a table
    Response.Write RecToTable (objRec)

    objRec.Close
    Set objRec=Nothing


    %>
    </body>
    </html>

    I need work out this little kink
    any help would be greatly appreciated

    Thanks,

    Adam Perfetti
    adam@trinityhosting.com

  2. #2
    John Guest

    Too Few Parameters (reply)

    Hi Adam,

    This board is for discussion about questions on ASP-db which is a tool which does all that hard work you&#39;re doing for you! You&#39;ll need to post your question on the ASP support forum. You can check out ASP-db at www.aspdb.com

    Thanks,
    John


    ------------
    Adam P. at 3/26/99 1:21:53 PM

    I am trying to search an access database using vbscript.
    I am writing my code in front page 98.
    The query gets it&#39;s parameters from a text box and a selection list.
    The query works if the user inputs something into the text box and the selection list.
    It even works if something is chosen from the selection list and the text box is left empty.
    If someone enters something into the text box,
    and does not choose something from the selection list I get this error:

    Microsoft OLE DB Provider for ODBC Drivers error &#39;80040e10&#39;

    [Microsoft][ODBC Microsoft Access 97 Driver] Too few parameters. Expected 1.

    Here is my code:

    <html>
    <!--#INCLUDE FILE= CkflgStore.inc -->
    <!--#INCLUDE FILE= adovbs.inc -->
    <!--#include file= RecToTable.asp-->
    <!--#include file= ListBox.asp-->

    <head>
    <meta http-equiv=&#34;Content-Type&#34; content=&#34;text/html; charset=iso-8859-1&#34;>
    <title>Search</title>
    </head>

    <body>
    <%
    Dim objRecSeries &#39;Recordset to produce selection list on form
    Dim objRec &#39;Recordset Produced by Query
    Dim strDriver &#39;Parameter: Contents of textbox on form
    Dim strSeries &#39;Parameter: Contents of selection list on form
    Dim objCommand &#39;Command to Produce objRec
    Dim strSql &#39;SQL String

    strDriver= Request.form(&#34;Driver&#34
    strSeries= Request.Form(&#34;series&#34

    set objRecSeries= Server.CreateObject (&#34;ADODB.Recordset&#34
    objRecSeries.open &#34;tblSeries&#34;,strconn,adOpenDynamic,adLockRe adOnly,adCmdTable

    &#39;This include file is a function that makes a txtBox and Selection list
    response.write ListBox (objRecSeries)

    strSql=&#34;SELECT * FROM tblCollectible &#34;

    &#39;build SQL statement according to what user chooses
    &#39; &#34;Choose a Series&#34; is the default for Selection List and means nothing was &#39;chosen
    if strSeries = &#34;Choose a Series&#34; then
    if strDriver <> &#34;&#34; then
    strSql= strSql & &#34; WHERE strDriver= &#39;&#34;&strDriver&&#34;&#39; &#34;
    else
    Response.write &#34;<center><h2>Please Specify Search Criteria</h2></center>&#34;
    end if
    else
    if strDriver <> &#34;&#34; then
    strSql= strSql & &#34; WHERE Driver= &#39;&#34;&strDriver&&#34;&#39; and SeriesName=&#39;&#34;&strSeries&&#34;&#39;&#34;
    else
    strSql= strSql & &#34; WHERE SeriesName= &#39;&#34;&strSeries&&#34;&#39; &#34;
    end if
    end if

    &#39;Create Command
    Set objCommand= Server.CreateObject (&#34;ADODB.Command&#34
    objCommand.ActiveConnection= strConn
    objCommand.CommandText= strSql
    objCommand.CommandType= adCmdText

    &#39;Create recordset to be displayed
    Set objRec=Server.createobject (&#34;ADODB.Recordset&#34
    set objRec= objCommand.Execute

    &#39;call function to write data to a table
    Response.Write RecToTable (objRec)

    objRec.Close
    Set objRec=Nothing


    %>
    </body>
    </html>

    I need work out this little kink
    any help would be greatly appreciated

    Thanks,

    Adam Perfetti
    adam@trinityhosting.com

Posting Permissions

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