Tema: Ejecutar SP
Ver Mensaje Individual
  #5 (permalink)  
Antiguo 15/07/2002, 11:23
jygc
 
Fecha de Ingreso: julio-2002
Mensajes: 12
Antigüedad: 22 años, 10 meses
Puntos: 0
Re: Ejecutar SP

Mi problema es que los SP necesitan parametros y esos se los quisiera mandar desde mi ASP y no siempre es la misma cantidad de parametros ejem.
ejecutar spAltas con 4 parametros, en otra opereacion ejecutar spBajas con 1 parametro etc...yo tengo este dll pero me marca el sig error

"Procedure 'spProject' expects parameter '@Param', which was not supplied."

Public Function ExecSQL(spName As String, ParamArray Param() As Variant) As ADODB.Recordset

Dim rs As ADODB.Recordset
Dim cmd As ADODB.Command
Dim pmt As ADODB.Parameter
Dim LcnConn As ADODB.Connection
Dim i As Long

On Error GoTo ErrHandler

Set cmd = New ADODB.Command
Set rs = New ADODB.Recordset
Set LcnConn = New ADODB.Connection
LcnConn.CursorLocation = adUseClient
LcnConn.Open MsConnectionStr

i = 0
With cmd
.ActiveConnection = LcnConn
.CommandType = adCmdStoredProc
.CommandText = "[" & spName & "]"
For Each pmt In .Parameters
pmt.Value = Param(i)
i = i + 1
Next
End With

With rs
.CursorLocation = adUseClient
.Open cmd, , adOpenStatic
Set cmd.ActiveConnection = Nothing
Set cmd = Nothing
Set .ActiveConnection = Nothing
End With

Set ExecSQL = rs
Exit Function

ErrHandler:
'Codigo para manejar el error

End Function