Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Cannot figure out where is the problem with code to add row

Reply
Thread Tools

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

 
 
Jack
Guest
Posts: n/a
 
      01-03-2006
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.


 
Reply With Quote
 
 
 
 
Chris Hohmann
Guest
Posts: n/a
 
      01-04-2006
"Jack" <> wrote in message
news:658C30D7-61EE-48B2-B1E8-...
> 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.


 
Reply With Quote
 
 
 
 
Jack
Guest
Posts: n/a
 
      01-04-2006
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:658C30D7-61EE-48B2-B1E8-...
> > 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.
>
>
>

 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      01-04-2006
You might want to try out my stored procedure code generator available at
http://www.thrasherwebdesign.com/ind...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:658C30D7-61EE-48B2-B1E8-...
>>> 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"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot figure out underlapping menu problem JimmyHoffa HTML 5 01-07-2007 07:09 PM
How to figure out on which row of a table I click e.g. a checkbox Stefan Mueller Javascript 4 01-26-2006 05:35 PM
How to figure out on which row of a table I click e.g. a checkbox Stefan Mueller HTML 2 01-23-2006 12:46 PM
Cannot figure out error in asp code Jack ASP General 2 07-27-2004 05:29 AM
Trying to figure out how to add a second KeyCode to an onkeydown event Matthew Javascript 1 02-10-2004 07:34 PM



Advertisments
 



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