I have a app that was written in VS 2008 for .net 2, upgraded to VS 2010 and built for .net 4. In this app is a Crystal Report. There should be absolutely NO database interaction done by the report. I manually set the various ITextObject fields from one of the objects in my project.
Example:
to = (CrystalDecisions.CrystalReports.Engine.TextObject)crystalPrint.Section2.ReportObjects["tbName"];
to.Text = visitor.first + " " + visitor.last;
to = (CrystalDecisions.CrystalReports.Engine.TextObject)crystalPrint.Section2.ReportObjects["tbCompany"];
to.Text = visitor.company;
where visitor
is the class that I'm pulling data from.
Again, there should be absolutely NO database interaction done with this report, and yet, it somehow thinks that it should be hitting a database.
Here's the relevant stack trace: CrystalDecisions.ReportAppServer.DataSetConversion
EDIT: It's blowing up when I call .PrintToPrinter(1, false, 1, 0);
*EDIT / UPDATE * I poked into the app.config file, and I found this little block
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
With that in the app, my report prints. With that commented out, it blows up.....
EDIT 3:
More source code:
cryBadge crystalPrint = new cryBadge();
crystalPrint.ReportOptions.EnableSaveDataWithReport = false;
//NOTE: pi is an internal object used to find printer information.
crystalPrint.PrintOptions.PrinterName = pi.PrinterName;
numSize = pi.FindPaperSizeIndex(height, wid);
to = (CrystalDecisions.CrystalReports.Engine.TextObject)crystalPrint.Section2.ReportObjects["tbName"];
to.Text = visitor.first + " " + visitor.last;
to = (CrystalDecisions.CrystalReports.Engine.TextObject)crystalPrint.Section2.ReportObjects["tbCompany"];
to.Text = visitor.company;
crystalPrint.PrintOptions.PaperOrientation = CrystalDecisions.Shared.PaperOrientation.Landscape;
crystalPrint.PrintToPrinter(1, false, 1, 0);