Skip to Content
0
Former Member
Dec 23, 2010 at 09:28 PM

Internal error exception when try to export Crystal Report using V2008 C#

1056 Views

Hello

Im working in an application that should send a parameter to a crystal report. Everything works fine when i test the report in the CR 2008 and shows the information correctly

After has the report working, i design a Visual C# application using forms and loading and exporting the report, which still works ok (generates the pdf file with the information)

Then i convert this application as a console application. The point is i need the report working as a windows service, to generate it every 15 minutes without user intervention (but try it as a console application first to be sure it will work ok before creating as a service)

Then i started the service. But when i call the report it sends an exception that i cannot understand:

Internal exception No se pudo abrir la conexion.

No se pudo abrir la conexion.

Prueba {DDE88B40-8A22-4EDB-9DEE-A5033DAA0140}.rpt

This is my code for the report that works fine as long as i don´t put any parameter into the sql command:

ReportDocument cryRpt = new ReportDocument();

cryRpt.Load(nomRepU);

cryRpt.Refresh();

cryRpt.SetParameterValue("EVAId", evaID);

//

ExportOptions CrExportOptions = new ExportOptions();

DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();

PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();

CrDiskFileDestinationOptions.DiskFileName = @"" + path + "

" + nomRepPDF_Exp;

CrExportOptions = cryRpt.ExportOptions;

CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;

CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;

CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;

CrExportOptions.FormatOptions = CrFormatTypeOptions;

cryRpt.Export(); -

-


here i get the exception

I checked that the parameter is being read correctly in the crystal report as i remove all the sql commands and just put the parameter in the heading of the report, and is show as supposed and generates the pdf file automatically, but when i assign the parameter to the sql command (select * from myTable where idTable = {?EVAId} ) the crystal report send the exception i mentioned above

I don't know what to do, i don't know if i configuring correctly the report or something is missing. I would appreciate any help. If need more information please let me know. This is making me crazy

Thanks in advance

Veronica Estrada