aout cursor staoed procedure and vb6 (ado)



Hi : I create the simple cursor stored procedure as follow :
CREATE PROCEDURE SP_CURSORSAMPLE
@retValue nvarchar(15) output

AS
DECLARE @iAcID INT,
@nSumAmount Money,
@sType nVarchar(50),
@iDetailID INT

DECLARE curBsDetail CURSOR FOR

SELECT sTenantCode
FROM tenantprofile

OPEN curBsDetail
FETCH NEXT FROM curBsDetail INTO
@retValue

WHILE @@FETCH_STATUS = 0
BEGIN

print @retValue

FETCH NEXT FROM curBsDetail INTO
@retValue
END

CLOSE curBsDetail
DEALLOCATE curBsDetail

if I use ado.command to execute how can I get return value of retValue
during the command is execute : I try to write the similar vb code but it
not work

Dim Cmd As Command
de.cnn.Open
Set Cmd = New Command
With Cmd
.CommandText = "SP_CURSORSAMPLE"
.CommandType = adCmdStoredProc
.ActiveConnection = de.cnn
.Parameters.Append .CreateParameter("retValue", adVarWChar,
adParamOutput, 15)
.Execute , , adAsyncFetch '<--- start ASYNCHROUS


Do While (.State And adStateExecuting) = adStateExecuting
Debug.Print .Parameters("retValue")
Loop

End With
can anyoneresolve my problem ?

Thanks


.


Loading