No, no es tonta tu pregunta............
Primero voy a la base de datos a buscar unidades (no se repiten) luego, creo un PDF por cada unidad, el formato de reporte es el mismo solo que contiene diferente informacion.
Acabo de hacer esto, que opinas?
Como limpio la memoria????????????????????????????
Le estoy agregando memoria pero no se si en realidad eso funcione
Código:
IntPtr ptr = Marshal.AllocHGlobal(1024);
GC.AddMemoryPressure(1024);
ReportDocument rptDocument = new ReportDocument();
rptDocument.Load(Settings.Default.PathReportes + NombreReporteCrystal);
DiskFileDestinationOptions destino = new DiskFileDestinationOptions();
ExportOptions Exp = new CrystalDecisions.Shared.ExportOptions();
Exp.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
Exp.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
destino.DiskFileName = RutaDestino + @"\" + NomPDF;
Exp.ExportDestinationOptions = destino;
rptDocument.Export(Exp);
rptDocument.Dispose();
Contador++;
if (ptr != IntPtr.Zero)
{
Marshal.FreeHGlobal(ptr);
ptr = IntPtr.Zero;
GC.RemoveMemoryPressure(1024);
}