Re: stored procedure vs parámetro de salida
Posted by:
Ruben BC
Date: July 10, 2008 12:50PM
Si tu generás un recordset en tu SP, lo recibís sin problemas en el visual.
Public Function MercaVendida(pDepo As Long, pDesde As Date, pHasta As Date) As Recordset
Set Qy = New Command
Set Qy.ActiveConnection = mCn
Qy.CommandType = adCmdStoredProc
Qy.Parameters.Append Qy.CreateParameter("pRemi", adNumeric, adParamInput, , pDepo)
Qy.Parameters.Append Qy.CreateParameter("pDesde", adDate, adParamInput, , pDesde)
Qy.Parameters.Append Qy.CreateParameter("pHasta", adDate, adParamInput, , pHasta)
Qy.CommandText = "MercaVendida"
Set MercaVendida = Qy.Execute
Set Qy = Nothing
End Function
Y en cuanto a la invocación de una function es así
Public Function SiguienteSF(pSubFa As Long) As Long
Set mRx = New Recordset
Set Qy = New Command
Set Qy.ActiveConnection = mCn
Qy.CommandType = adCmdUnknown
Qy.CommandText = "Select SigSubFa(" & pSubFa & ")"
Set mRx = Qy.Execute(Devu)
SiguienteSF = mRx.Fields(0)
mRx.Close
Set mRx = Nothing
End Function