Cannot figure out where is the problem with code to add row

Discussion in 'ASP General' started by Jack, Jan 3, 2006.

  1. Jack

    Jack Guest

    Hi,
    I have the following code which addes a publisher to the publishers table in
    the pubs database. However, for some reason, I am getting the following error:

    Error Type:
    Microsoft VBScript runtime (0x800A01B6)
    Object doesn't support this property or method: 'CreateParameters'
    /beginaspdatabase1/ProfASP_AddPublisher.asp, line 40 The line 40 is the
    first instance of the createparameter statement.

    CODE:

    <!-- #INCLUDE FILE="Connection1.asp" -->
    <!-- #include file="adovbs.inc" -->
    <HTML>
    <HEAD>
    </HEAD>
    <BODY>

    <%


    Dim cmdPublisher, returnvalue, lngrecs

    set cmdPublisher = server.CreateObject("ADODB.Command")

    'Dim pub_id, pub_name, pub_city, pub_state, pub_country

    'pub_id = Request.Form("txtPubID")
    'Response.Write pub_id & "<br>"

    'pub_name = Request.Form("txtPubName")
    'Response.Write pub_name & "<br>"

    'pub_city = Request.Form("txtPubCity")
    'Response.Write pub_city & "<br>"

    'pub_state = Request.Form("txtPubState")
    'Response.Write pub_state & "<br>"

    'pub_country = Request.Form("txtPubCountry")
    'Response.write pub_country & "<br>"

    'Response.End
    With cmdPublisher
    .ActiveConnection = objConn
    .CommandText = "proc_insertpublisher"
    .CommandType = adCmdStoredProc

    'Create the parameters

    .Parameters.Append .CreateParameters ("returnvalue", adInteger,
    adParamReturnValue)
    .Parameters.Append .CreateParameters ("pub_id", adChar, adParamInput, 4)
    .Parameters.Append .CreateParameters ("pub_name", adVarWChar,
    adParamInput, 40)
    .Parameters.Append .CreateParameters ("pub_city", adVarWChar,
    adParamInput, 20)
    .Parameters.Append .CreateParameters ("pub_state", adChar, adParamInput, 2)
    .Parameters.Append .CreateParameters ("pub_country", adVarWChar,
    adParamInput, 30)

    'Now set the parameter values
    .Parameters("pub_id") = Request.Form("txtPubID") 'Here it is to be noted
    that the Parameter(0) is reserved for return value
    .Parameters("pub_name") = Request.Form("txtPubName")
    .Parameters("pub_city") = Request.Form("txtPubCity")
    .Parameters("pub_state") = Request.Form("txtPubState")
    .Parameters("pub_country") = Request.Form("txtPubCountry")

    'Run the stored procedure

    cmd.Execute lngRecs, ,adExecuteNoRecords
    'Now extract the return value
    lngAdded = .Parameters("returnvalue")
    end with
    %>

    </BODY>
    </HTML>

    I would appreciate any insgiht to the problem. Thanks.
     
    Jack, Jan 3, 2006
    #1
    1. Advertising

  2. "Jack" <> wrote in message
    news:...
    > Hi,
    > I have the following code which addes a publisher to the publishers table
    > in
    > the pubs database. However, for some reason, I am getting the following
    > error:
    >
    > Error Type:
    > Microsoft VBScript runtime (0x800A01B6)
    > Object doesn't support this property or method: 'CreateParameters'
    > /beginaspdatabase1/ProfASP_AddPublisher.asp, line 40 The line 40 is the
    > first instance of the createparameter statement.

    [snip]

    The method name is CreateParameter, not CreateParameters. Singular, not
    plural.
     
    Chris Hohmann, Jan 4, 2006
    #2
    1. Advertising

  3. Jack

    Jack Guest

    Thanks Chris for pointing out the error. It was small yet valuable to me.
    With the suggested change the code works fine. Best regards.


    "Chris Hohmann" wrote:

    > "Jack" <> wrote in message
    > news:...
    > > Hi,
    > > I have the following code which addes a publisher to the publishers table
    > > in
    > > the pubs database. However, for some reason, I am getting the following
    > > error:
    > >
    > > Error Type:
    > > Microsoft VBScript runtime (0x800A01B6)
    > > Object doesn't support this property or method: 'CreateParameters'
    > > /beginaspdatabase1/ProfASP_AddPublisher.asp, line 40 The line 40 is the
    > > first instance of the createparameter statement.

    > [snip]
    >
    > The method name is CreateParameter, not CreateParameters. Singular, not
    > plural.
    >
    >
    >
     
    Jack, Jan 4, 2006
    #3
  4. You might want to try out my stored procedure code generator available at
    http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp&c=&a=clear

    Jack wrote:
    > Thanks Chris for pointing out the error. It was small yet valuable to
    > me. With the suggested change the code works fine. Best regards.
    >
    >
    > "Chris Hohmann" wrote:
    >
    >> "Jack" <> wrote in message
    >> news:...
    >>> Hi,
    >>> I have the following code which addes a publisher to the publishers
    >>> table in
    >>> the pubs database. However, for some reason, I am getting the
    >>> following error:
    >>>
    >>> Error Type:
    >>> Microsoft VBScript runtime (0x800A01B6)
    >>> Object doesn't support this property or method: 'CreateParameters'
    >>> /beginaspdatabase1/ProfASP_AddPublisher.asp, line 40 The line 40 is
    >>> the first instance of the createparameter statement.

    >> [snip]
    >>
    >> The method name is CreateParameter, not CreateParameters. Singular,
    >> not plural.


    --
    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 [MVP], Jan 4, 2006
    #4
    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. Stefan Mueller
    Replies:
    2
    Views:
    397
    Stefan Mueller
    Jan 23, 2006
  2. JimmyHoffa
    Replies:
    5
    Views:
    473
    JimmyHoffa
    Jan 7, 2007
  3. Jack

    Cannot figure out error in asp code

    Jack, Jul 25, 2004, in forum: ASP General
    Replies:
    2
    Views:
    199
    Bã§TãRÐ
    Jul 27, 2004
  4. Stefan Mueller
    Replies:
    4
    Views:
    136
    Stefan Mueller
    Jan 26, 2006
  5. ApathyBear
    Replies:
    9
    Views:
    97
    Dave Angel
    Feb 20, 2014
Loading...

Share This Page