Problem in Stored procedure parameter

S

Sunny

This is my stored procedure on SQL server"
CREATE PROCEDURE CalculateSales
@SalesAmt money = 0 OUTPUT,
@SalesmanId char(10)

AS
Begin
code...
end


Following is the code in vba to call stored procedure:

Dim adoCommand As Command
Dim objParam As Parameter

Set adoCommand = New Command
adoCommand.CommandText = "CalculateSalesl"
adoCommand.CommandType = adCmdStoredProc
Set adoCommand.ActiveConnection = cnObject

Set objParam = adoCommand.CreateParameter("@SalesAmt", adCurrency,
adParamOutput, , 0)
adoCommand.Parameters.Append objParam

Set objParam = adoCommand.CreateParameter("@SalesmanId", adChar,
adParamInput, , "Adam ")
adoCommand.Parameters.Append objParam

adoCommand.Execute
nSales = adoCommand.Parameters(0)
Set adoCommand = Nothing

When I run vba code I get this error:
Type mismatch on line Set objParam = adoCommand.CreateParameter("@SalesAmt",
adCurrency, adParamOutput, , 0)

What am I doing wrong here? Please advice me.

Thanks for looking into it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top