Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 OUTPUT PRARAMETER DOESN'T RETURN VALUE

Author  Topic 

TAS
Yak Posting Veteran

65 Posts

Posted - 2004-01-23 : 11:41:49
I have a store procedure having a decimal datatype output parameter. I want to execute this store procedure with adodb.object, but the output parameter always returns 0.Anybody knows why?

-----Store Procedure

Alter Procedure ProcSumAgentFee
@AgentCode varchar(5),
@SumAgentFee decimal(9,2) output
As
Set nocount on
Select @SumAgentFee=(Select Sum(decAmt) from tblAgentFee Where vchrAgentCode=@AgentCode)
Return


---VBA Code:

Set cmdGetAgentFee = New ADODB.Command
With cmdGetAgentFee
.ActiveConnection = CurrentProject.Connection
.CommandText = "ProcAgentFee"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter("@AgentCode", adVarChar, adParamInput, 50, Forms!updtMasterInsfrm!NewAgentCode)
Set prmtSumAgentFee = .CreateParameter("@SumAgentFee", adDecimal, adParamOutput)
prmtSumAgentFee.Precision = 9
prmtSumAgentFee.NumericScale = 2
.Parameters.Append prmtSumAgentFee
CurAgentFee = .Parameters("@SumAgentFee")

SamC
White Water Yakist

3467 Posts

Posted - 2004-01-23 : 11:59:13
Hard to say.

The posted code leads up to the execution but doesn't include the execution, or the retrieval of the output parameter after the execution.

Search OUTPUT PARAMETER on the SQLTEAM home page. There are articles about this.
Go to Top of Page

MichaelP
Jedi Yak

2489 Posts

Posted - 2004-01-23 : 12:09:20
TAS,
I don't see an EXECUTE anyplace in your VBA code. I suspect that's what the problem is.

You need a cmdGetAgentFee.Execute before you try to get the value of the output param.

Michael

<Yoda>Use the Search page you must. Find the answer you will.</Yoda>
Go to Top of Page
   

- Advertisement -