Te dire yo como lo hago:
Creo los parametros asi, esto es en C#
Código:
SqlParameter[] parametros = new SqlParameter[8];
parametros[0] = new SqlParameter("@strlote",SqlDbType.VarChar,3);
parametros[0].Value=Lote;
parametros[0].Direction = ParameterDirection.Output;
parametros[1] = new SqlParameter("@strtipofecha",SqlDbType.VarChar,1);
parametros[1].Value=TipoFecha;
parametros[2] = new SqlParameter("@FechaInicial",SqlDbType.DateTime);
parametros[2].Value=FechaInicial;
Luego los adjunto al command con un foreach
seria algo como esto:
Cita: foreach(SqlParameter p in parametros)
{
cmd.Parameters.Add(p);
}
Luego ejecuto el sp y cuando termina la ejecucion el parametros[0] viene con el valor que retorno el procedimiento almacenado
Saludos