Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print error with CR and C#

Status
Not open for further replies.

caudet

Programmer
Oct 2, 2003
15
CA
Hi,

I was using a program I made to print a report with Crystal report and C#. Everything was working fine. I decided to use it(or large part of it anyway) to build a new report(label format, 1"x4"inch). After having removed the part of the program I didn't needed and build the new report when I try to print with the usual command("report.PrintToPrinter(1, false,0,0);") I receive this error has the message of the System.Exception catch:

"Query Engine Error: 'C:\SCG\srv\etiquetteOF\Etiquette.rpt'"

The stacktrace shows this:

" at .K(String 
, EngineExceptionErrorID  )
at .F(Int16 , Int32 )
at .E(Int16 )
at CrystalDecisions.CrystalReports.Engine.FormatEngine.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN)
at SCG_Impression_Etiquette.Class1.PrintReport(ReportDocument report, String& printerName) in c:\documents and settings\chaaud\my documents\visual studio projects\keyboardhook\impressionof_etiquette\class1.cs:line 266"

and the source:

"CrystalDecisions.CrystalReports.Engine"

The first program I made is still working, so I've ruled out a defective engine as part of my problem. Anyone as a clue on what I should do or from where the error migth be coming?

Any help would be appreciated. I can give more info if you need to know something more specific.

thank you.

Charles
 
What's at line 266? Is that:
SCG_Impression_Etiquette.Class1.PrintReport(ReportDocument report, String& printerName)
in which case perhaps the printerName is not correctly initialized. That would be your starting point.
 
The code at line 266:

report.PrintToPrinter(1, false,0,0);

Having exhausted all my option I simply rebuild a new project from the ground up and copy pasted most of my code. Now it's work, sometime Visual Studio work in a strange way...

Thanks for you answer!

Charles
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top