I tried using NCReport in my application as a component for reporting services. I am using Visual Studio 2008 and Qt 4.5.3 for development and I have also installed a specially build version of NCReport compatible to Qt 4.5.3. Since I have VS solution, so my projects are not .pro and are .vcproj.

Instead of editing my .vcproj I have added the necessary dlls (ncreport2.dll, ncreportd2.dll), included the include folder, added the necessary library and also copied some of the dlls available in the (NCREPORT INSTALL FOLDER)/bin directory to my projetc's debug directory.

Now my code is
Qt Code:
  1. report = new NCReport();
  2. report->reset(true);
  3. report->setReportFile(QString(QApplication::applicationDirPath() +
  4. QDir::separator() + "reports" + QDir::separator()
  5. + "MitigationAnalysis.xml"));
  6. output = 0;
  7. output = new NCReportPreviewOutput();
  8. output->setAutoDelete( false );
  9. report->setOutput(output);
  10. report->runReport();
  11. if(!report->hasError())
  12. {
  13. pv = new NCReportPreviewWindow();
  14. pv->setReport( report );
  15. pv->setOutput((NCReportPreviewOutput *) output);
  16. pv->setWindowModality(Qt::ApplicationModal);
  17. pv->setAttribute(Qt::WA_DeleteOnClose);
  18. pv->show();
  19. }
  20. else if( report->hasError())
  21. {
  22. bool error = report->hasError();
  23. QMessageBox::about(this,"Error in Report", report->lastErrorMsg());
  24. }
To copy to clipboard, switch view to plain text mode 

When I try to run this code the program throws and Access Violation Exception reading location........ and breaks at the line report->runReport(). No other information and I get confused about what to do.

Now, accidentally I tried to change the Filename of report and gave some wrong input string to it , and what I see is that the program doesn't break and shows me the last error message occurred in the report.

I am unable to understand this behavior. I am developing my application on WINDOWS XP (service pack 3). Please guide me if any one has faced the same problem or do me this favor.

Thanks