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


J

Jack

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.
 
Ad

Advertisements

C

Chris Hohmann

Jack said:
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.
 
J

Jack

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 said:
Jack said:
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.
 
Ad

Advertisements

B

Bob Barrows [MVP]

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
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 said:
Jack said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top