May 6, 2002 at 4:24 pm
I am calling a stored proc via ASP/ADO code and occassionaly get the following error:
Formal parameter '@param' was defined as OUTPUT but the actual parameter not declared OUTPUT.
The curious thing is neither the stored proc or ASP/ADO code have defined the paramater as an OUTPUT.
Has anyone else encountered this or have suggestions?
In the below example @pageType is the parameter I get the error with.
Stored Proc Code
----------------------
ALTER Procedure pred_getProductRedirect
@productGUID uniqueidentifier,
@productRedirectType int,
@pageType int,
@targetURL varchar(200) OUTPUT
AS BEGIN
SET NOCOUNT ON
DECLARE @targetGUID uniqueidentifier
DECLARE @return int
-- Retrieve the target product GUID.
SELECT@targetGUID = pred_TargetGUID
FROMECM_ProductRedirect
WHEREprd_GUID = @productGUID AND pred_ProductRedirectType = @productRedirectType
-- Retrieve the URL for the target GUID and page type.
EXEC @return = pred_GetPageRedirect @targetGUID, @pageType, @targetURL OUTPUT
IF (@return <> 0) RETURN -1
-- Update statistics.
UPDATEECM_ProductRedirect
SETpred_Count = pred_Count + 1
WHEREprd_GUID = @productGUID AND pred_ProductRedirectType = @productRedirectType
RETURN 0
END
ASP/ADO Code
----------------------
Set oCmd = Server.CreateObject("ADODB.Command")
With oCmd
.ActiveConnection = oCnn
.CommandType = adCmdStoredProc
.CommandText = "pred_getProductRedirect"
.Parameters.Append = .CreateParameter("@return", adInteger, adParamReturnValue)
.Parameters.Append = .CreateParameter("@prodGUID", adGUID, adParamInput, , sProdGUID)
.Parameters.Append = .CreateParameter("@productRedirectType", adInteger, adParamInput, , nProductRedirectType)
.Parameters.Append = .CreateParameter("@pageType", adInteger, adParamInput, , nPageType)
.Parameters.Append = .CreateParameter("@targetURL", adVarChar, adParamOutput, 200)
Call .Execute(,,adExecuteNoRecords)
May 6, 2002 at 7:01 pm
Looks ok - maybe the params collection is not getting set to nothing, ending up with extra params? Just a guess.
Andy
May 6, 2002 at 7:48 pm
quote:
.Parameters.Append = .CreateParameter("@targetURL", adVarChar, adParamOutput, 200)
adParamOutput is your OUTPUT variable defined. I see nothing wrong here. But also I don't see this variable
quote:
@targetURL varchar(200) OUTPUT
being set anywhere inside your SP code. May be chocking on a NULL value. Try setting it to 'a' in you SP code to see what happens then.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply