| Abraham Andres Luna 2006-01-24, 7:07 pm |
| hello everyone,
i have yet to see any complete examples on how to do this. i've had to
peacemeal this solution from 20 different places.
does anyone know why this code would cause an {"Attempted to read or write
protected memory. This is often an indication that other memory is
corrupt."} System.Exception {System.AccessViolationException}
this is my code:
ApplicationClass appCrystal = new ApplicationClass();
string strFileName = @"C:\RDK\CallHistory.rpt";
Report rReport = appCrystal.OpenReport(strFileName,
CROpenReportMethod.crOpenReportByDefault);
DatabaseTableClass dtReport =
(DatabaseTableClass)rReport.Database.Tables[1];
appCrystal.LogOnServer(dtReport.DllName, dtReport.LogOnServerName,
dtReport.LogOnDatabaseName, dtReport.LogOnUserID, "pwd");
ExportOptionsClass eoReport = (ExportOptionsClass)rReport.ExportOptions;
eoReport.DestinationType = CRExportDestinationType.crEDTDiskFile;
eoReport.DiskFileName = @"pdfs\" +
Path. GetFileNameWithoutExtension(strFileName)
+ ".pdf";
eoReport.FormatType = CRExportFormatType.crEFTPortableDocFormat;
rReport.DisplayProgressDialog = false;
CRViewerClass vReport = new CRViewerClass();
vReport.ReportSource = rReport;
vReport.Refresh(); //Don't I have to call this method to get the most
current data in the report? It fails on this line.
rReport.Export(false);
while (appCrystal.CanClose())
{
Thread.Sleep(3000);
}
rReport = null;
appCrystal = null;
ty for your help
|