|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Cannot figure out where is the problem with code to add row
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.
Show quote
"Jack" <J***@discussions.microsoft.com> wrote in message The method name is CreateParameter, not CreateParameters. Singular, not news:658C30D7-61EE-48B2-B1E8-BDEED74EAE99@microsoft.com... > 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] plural. Thanks Chris for pointing out the error. It was small yet valuable to me.
With the suggested change the code works fine. Best regards. Show quote "Chris Hohmann" wrote: > "Jack" <J***@discussions.microsoft.com> wrote in message > news:658C30D7-61EE-48B2-B1E8-BDEED74EAE99@microsoft.com... > > 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. > > > 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: Show quote > 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" <J***@discussions.microsoft.com> wrote in message >> news:658C30D7-61EE-48B2-B1E8-BDEED74EAE99@microsoft.com... >>> 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"
Other interesting topics
|
|||||||||||||||||||||||