Q:

ADODB connection to run SQL Server Procedure

I'm currently trying to run a certain procedure (sql 2005) in VB6, passing some parameters:
Dim conn As Connection
Set conn = New Connection
conn. Open "Provider=whateverprovider;Data Source=whateversource;Database=whateverdatabase;User Id=whateverID;Password=whatever"
Dim CMD As ADODB.Command
Dim rs As ADODB.Recordset
Set CMD = New ADODB.Command
Set CMD.ActiveConnection = conn
CMD.CommandType = adCmdStoredProc
CMD.Parameters. Append CMD.CreateParameter("@EmpresaCNPJ", adVarChar, adParamInput, 14, "64687015000152")
CMD.Parameters. Append CMD.CreateParameter("@EntradaSaida", adChar, adParamInput, 1, "S")
CMD.Parameters. Append CMD.CreateParameter("@Participante", adVarChar, adParamInput, 60, "0000000020")
CMD.Parameters. Append CMD.CreateParameter("@nroNotaFiscal", adInteger, adParamInput)
CMD.Parameters("@nroNotaFiscal").Value = 2289
CMD.Parameters. Append CMD.CreateParameter("@serieNotaFiscal", adSmallInt, adParamInput)
CMD.Parameters("@serieNotaFiscal").Value = 1
Set rs = CMD.Execute

In the last line i get the following error message:
alt text http://dl.dropbox.com/u/3045472/ERRO.png
Which in English it reads:
"syntax error or access violation"
This message is REALLY generic, and I don't have a clue about where could the problem be. 
What did i do wrong ? 
Here is the parameter receiving part of the sql code in the procedure:
   @EmpresaCNPJ varchar(14), 
   @EntradaSaida char(1)=null, 
   @Participante varchar(60)=null, 
   @nroNotaFiscal int=null, 
   @serieNotaFiscal smallint=null, 
   @EtapaInicial tinyint=null, 
   @LineComplement varchar(255)=null 

I was told that not every parameter should be passed, and that it should work with just five (out of seven). 

A:

Where are you setting the name of the stored procedure? 
cmd. CommandName = ....
EDIT: Set the CommandName to the name of the stored procedure, before you begin to call Parameters. Append

