Link to home
Start Free TrialLog in
Avatar of rgodavarthi
rgodavarthi

asked on

stored procedure

When I am returning a data through output parameter from a stored procedure it is giving strange problems.
My code:
My stored procedure is:
use pubs
go

if exists(select name from sysobjects where name='Mytest' and type='p')
drop proc Mytest
go

create proc Mytest @param1 integer,@param2 integer output
as
select @param2=stor_id from sales where qty=@param1

My vb code is:

QSQL = "{ ? = call Mytest(?,?) }"
Set rdoqry = rdoCn.CreateQuery("", strSql)

rdoqry.rdoParameters(0).Direction = rdParamReturnValue

rdoqry(2).Direction = rdParamOutput
rdoqry(0).Direction = rdParamReturnValue

rdoqry.rdoParameters(1) = 5

rdoqry.OpenResultset (rdOpenStatic)
Dim temp As Integer
temp = rdoqry(2)

If rdoqry.rdoParameters(0) <> 0 Then
   MsgBox "Could not change"
End If

could you solve my problem or give me your style of writing code for problems like this?

Thanks,
Raj in christ.
ASKER CERTIFIED SOLUTION
Avatar of kponder
kponder

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rgodavarthi
rgodavarthi

ASKER

Do me a favour:

Just give a samle code with a stored procedure having two parameters one for input and other for output.
Call this in the front end and get data from the output parameter.

Please do it for me.

Raj in christ.