calling Stored Procedures
I am trying to call some stored procedures that reside on a database, and am receive the same error in IE.
THe error reads: Must declare variable '@UserID'
@UserID is one of the parameters passed into to stored procedure, and I do make reference to it in asp by calling a particular UserID using cmd.Parameters.
Can anyone fix my problem??
# 1 Re: calling Stored Procedures
it sounds like the stored procedure itself is generating this error. which means that it might not be declared correctly. Look at the following code and compare to your own
'stored procedure code:
CREATE PROCEDURE boc_GetAssetInfo (
@OrderLineID INT )
as
BEGIN
'your SQL code here...
END
then in code, i would call this proc like this:
set rs = Server.CreateObject("ADODB.Recordset")
set Cmd = Server.CreateObject("ADODB.Command")
With Cmd
.ActiveConnection = "Your Connection Object or string Here"
.CommandText = "boc_GetAssetInfo"
.CommandType = adCmdStoredProc
.CommandTimeout = 600
.Parameters.Append Cmd.CreateParameter("OrderLineID", adInteger, adParamInput)
.Parameters("OrderLineID") = iOrderLineID
End With
set rs = Cmd.Execute
hope this helps,
John
John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org