duda con codigo

29/12/2004 - 12:59 por Gustavo | Informe spam
Saludos, tengo dudas si esta bien o mal la llamada a este
proced almacenado y si en el procedimiento las distintas
funciones como sum, Count, avg se usan asi.

Espero me puedan ayudar.

Gracias


-esta es la llamda que envia un parametro-

Public Function ListarAcumXRegId() As ADODB.Recordset
Dim oConn As ADODB.Connection
Dim oCommand As ADODB.Command
Dim oRS As ADODB.Recordset
Set oConn = New ADODB.Connection
oConn.ConnectionString = "File name=" & App.Path
& "\oConn4.udl"
oConn.CursorLocation = adUseClient
oConn.Open
Set oCommand = New ADODB.Command
Set oCommand.ActiveConnection = oConn
oCommand.CommandType = adCmdStoredProc
oCommand.CommandText = "SPCons_ListarAcumXRegId"
oCommand.Parameters(1).Value = Me.RegistracionId

Set oRS = oCommand.Execute

Set ListarAcumXRegId = oRS

Set oRS = Nothing
Set oCommand = Nothing
Set oConn = Nothing

End Function

-y el strore proced-que devuelve un valor

CREATE PROCEDURE SPCons_ListarAcumXRegId
@intRegId_1 [numeric],
@Total [money] output

AS select @Total=Sum(precioCons) from Consumicion

where fecCons <> getdate()

and regId=@intRegId_1
GO
-

'La llamada se podria llegar a hacer asi "CreateParameter"
(no entiendo mucho eta forma, y como retornar valores)

oCommand.parameters cmd.CreateParameter
 

Leer las respuestas

#1 Isaias
29/12/2004 - 21:01 | Informe spam
considera declarar un RECORSET para almacenar los valores de retorno, tambien
ten en cuenta que la funcion GETDATE(), te devuelve el formato:

2004-12-29 14:01:56.640

Preguntas similares