For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Crystal Reports > January 2006 > 8.5 report viewer fails on refresh









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author 8.5 report viewer fails on refresh
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


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com