I cant make this thing work!


exec conta_resxuen_1
11,
2002,
'CG',
1,
'20030101',
'20030131',
'0',
'0',
'051100710001',
5, 0, 0

This SP just calculate some data from normal tables into temp table, I mean, calculates and insert into the temp table

Then Im trying to get this thing work in VB6 throught ADO


'************************************************* ***
Dim pcnnSistema As ADODB.Connection
Dim sSQLConsulta As String
Dim RsConsulta As ADODB.Recordset
Dim iNumReg As Integer
Dim lRegAfectados As Double
Dim i As Integer
Dim j As Integer

Dim cmdByRoyalty As ADODB.Command
Dim prmByRoyalty As ADODB.Parameter

Dim errLoop As Error

Set pcnnSistema = New ADODB.Connection


With pcnnSistema
.Provider = "SQLOLEDB"
.ConnectionString = "User ID=" & "user" & _
";Password=" & "xxxxxx" & _
";Data Source=" & "server" & _
";Initial Catalog=" & "base"
.Open

Set cmdByRoyalty = New ADODB.Command

Dim paramupd As ADODB.Parameter

.CommandTimeout = 3600
.CursorLocation = adUseServer


Set cmdByRoyalty.ActiveConnection = pcnnSistema

cmdByRoyalty.CommandText = "conta_resxuen_1"
cmdByRoyalty.CommandType = adCmdStoredProc

Set paramupd = cmdByRoyalty.CreateParameter("@pp_cia", adInteger, adParamInput, , 11)
cmdByRoyalty.Parameters.Append paramupd
Set paramupd = cmdByRoyalty.CreateParameter("@pp_eje", adInteger, adParamInput, , 2002)
cmdByRoyalty.Parameters.Append paramupd
Set paramupd = cmdByRoyalty.CreateParameter("@pp_lib", adVarChar, adParamInput, 4, "CG")
cmdByRoyalty.Parameters.Append paramupd
Set paramupd = cmdByRoyalty.CreateParameter("@pp_mon", adInteger, adParamInput, , 1)
cmdByRoyalty.Parameters.Append paramupd
Set paramupd = cmdByRoyalty.CreateParameter("@pp_fecha_i", adDate, adParamInput, , CDate("01/01/2003"))
cmdByRoyalty.Parameters.Append paramupd
Set paramupd = cmdByRoyalty.CreateParameter("@pp_fecha_f", adDate, adParamInput, , CDate("31/01/2003"))
cmdByRoyalty.Parameters.Append paramupd
Set paramupd = cmdByRoyalty.CreateParameter("@pp_est_cta", adVarChar, adParamInput, 250, "0")
cmdByRoyalty.Parameters.Append paramupd
Set paramupd = cmdByRoyalty.CreateParameter("@pp_est_ccs", adVarChar, adParamInput, 250, "0")
cmdByRoyalty.Parameters.Append paramupd
Set paramupd = cmdByRoyalty.CreateParameter("@pp_est_uen", adVarChar, adParamInput, 250, "051100710001")
cmdByRoyalty.Parameters.Append paramupd
Set paramupd = cmdByRoyalty.CreateParameter("@pp_nivel", adInteger, adParamInput, , 5)
cmdByRoyalty.Parameters.Append paramupd
Set paramupd = cmdByRoyalty.CreateParameter("@pp_ajustes", adInteger, adParamInput, , 0)
cmdByRoyalty.Parameters.Append paramupd
Set paramupd = cmdByRoyalty.CreateParameter("@pp_consol", adInteger, adParamInput, , 0)
cmdByRoyalty.Parameters.Append paramupd

cmdByRoyalty.Execute

'************************************************* ***


I get an error in this last line

Error number: -2147217871
Error in the method 'Execute' in object '_Command'


Does Anyone have any Idea ?


Thanks in advance
galediazc