Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADODB.Command error using Stored Proc

Status
Not open for further replies.

ElvisIncognito

IS-IT--Management
Feb 23, 2002
6
US
I'm trying to call a stored procedure:

CREATE PROCEDURE usp_osArray @Prodver numeric(9) AS SELECT Short, OS FROM platforms WHERE ProdVer= @ProdVer ORDER BY OSID DESC

using the following code:

Set cmdPassProdVer = Server.CreateObject("ADODB.Command")
cmdPassProdVer.CommandType = adCmdStoredProc
cmdPassProdVer.CommandText = "usp_osArray"
Set parValue = cmdPassProdVer.CreateParameter("@Prodver", adVarChar, adParamInput, 9, "8001")
cmdPassProdVer.Parameters.Append parValue
Set rsPlatforms = cmdPassProdVer.Execute

But no matter what I do, I get:

Error Type:
ADODB.Command (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/sandbox/80/matrix_template.asp, line 18

The first line of code above is line 17, so 18 is:
cmdPassProdVer.CommandType = adCmdStoredProc

I've spent hours now and I'm THOROUGHLY frustrated... This is my first attempt at using StoredProcs, and this page REALLY needs the help/boost...
 
I have now tried all three methods described on Microsoft's HOWTO page-
My two most recent attempts are:

'Set cn = Server.CreateObject("ADODB.Connection")
'Set rsPlatforms = Server.CreateObject("ADODB.Recordset")
'Set cmd = Server.CreateObject("ADODB.Command")
'cn.Open "TestMatrix", "IUSR", ""
'Set cmd.ActiveConnection = cn
'cmd.CommandText = "usp_osArray"
'cmd.CommandType = adCmdStoredProc
'' Ask the server about the parameters for the stored proc
'cmd.Parameters.Refresh
'' Assign a value to the 2nd parameter.
'' Index of 0 represents first parameter.
'cmd.Parameters(1) = 8001
'Set rsPlatforms = cmd.Execute


Set cn = Server.CreateObject("ADODB.Connection")
Set rsPlatforms = Server.CreateObject("ADODB.Recordset")
cn.Open "TestMatrix", "IUSR", ""
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = cn
cmd.CommandText = "usp_osArray"
cmd.CommandType = adCmdStoredProc
cmd.Parameters.Append cmd.CreateParameter("Param1", adInteger, adParamInput)
' Set value of Param1 of the default collection to 22
cmd("Param1") = 22
Set rsPlatforms = cmd.Execute

I HAVE
<!-- #include file=&quot;adovbs.inc&quot; -->

but I continue to get the same error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top