Showing posts with label craxdrt9dll. Show all posts
Showing posts with label craxdrt9dll. Show all posts

Saturday, February 11, 2012

"craxdrt9.dll" version "9.2.3.1368" errors at runtime with multiple threads STA

"craxdrt9.dll" version "9.2.3.1368" errors at runtime with multiple threads with ApartmentState as STA or MTA

I would appreciate any help on the following:

Keep getting the the following error from "Crystal Reports":

- Using "C:\Program Files\Crystal Decisions\Report Designer Component\craxdrt9.dll" version "9.2.3.1368"

Error on using multiple threads with thread.ApartmentState = ApartmentState.STA:

Object reference not set to an instance of an object.
at CRAXDRT.DatabaseTableClass.SetPrivateData(Int32 dataTag, Object data)
at TestCrystalReports1.QCrystalReports.QCrystalReportObject.processReport(IReport& iReport, Hashtable collReportDataRs, Boolean& m_btnCancelPressed) in E:\QECM\Tools\ReportingTools\TestApps\TestCrystalReports1\QCrystalReports\QCrystalReportObject.cs:line 127
at TestCrystalReports1.QCrystalReports.QCrystalReportObject.processSubReport(IReport& iReport, Hashtable collReportDataRs, Boolean& m_btnCancelPressed) in E:\QECM\Tools\ReportingTools\TestApps\TestCrystalReports1\QCrystalReports\QCrystalReportObject.cs:line 179
at TestCrystalReports1.QCrystalReports.QCrystalReportObject.runPrintJob(String rptFilePathStr, Hashtable recordsetHashTable) in E:\QECM\Tools\ReportingTools\TestApps\TestCrystalReports1\QCrystalReports\QCrystalReportObject.cs:line 81
at TestCrystalReports1.PrintRequest.runPrintRequest() in E:\QECM\Tools\ReportingTools\TestApps\TestCrystalReports1\PrintRequest.cs:line 79

Error on using multiple threads with thread.ApartmentState = ApartmentState.STA or ApartmentState.MTA:

Invalid directory.
at CRAXDRT.ApplicationClass.OpenReport(String pFileName, Object OpenMethod)
at TestCrystalReports1.QCrystalReports.QCrystalReportObject.runPrintJob(String rptFilePathStr, Hashtable recordsetHashTable) in E:\QECM\Tools\ReportingTools\TestApps\TestCrystalReports1\QCrystalReports\QCrystalReportObject.cs:line 77
at TestCrystalReports1.PrintRequest.runPrintRequest() in E:\QECM\Tools\ReportingTools\TestApps\TestCrystalReports1\PrintRequest.cs:line 79

Code extract - C# / .net application:

References: Interop.CRAXDRT.dll

- Thread running the "processReport" method - ApartmentState - tried both STA & MTA
- Problem usually occurs in case of multiple threads or multiple calls within a thread

private static int DATA_INPUT_TYPE_ADO = 3;

private void processReport (
ref IReport iReport, // Report instance
System.Collections.Hashtable collReportDataRs, // Report data
ref bool m_btnCancelPressed // Cancel button
)
{
// Get the database
IDatabase iDatabase = (IDatabase) iReport.Database;

// Get the database tables
IDatabaseTables iDatabaseTables = (IDatabaseTables) iDatabase.Tables;

// Loop through the tables
int iTotalTables = iDatabaseTables.Count;
for ( int iTblCount = 1; iTblCount <= iTotalTables; ++iTblCount )
{
if ( m_btnCancelPressed == true )
return;

// Get table name
IDatabaseTable iDatabaseTable = (IDatabaseTable) iDatabaseTables[iTblCount];

// Get the relevant recordset from the collection passed
System.String bsTableName = iDatabaseTable.Name;

ADODB._Recordset rs = (ADODB._Recordset) collReportDataRs [ bsTableName ];
if ( rs == null )
{
throw new Exception( "Data not found: " + bsTableName );
}

// Set data for this table
iDatabaseTable.SetPrivateData( DATA_INPUT_TYPE_ADO, rs);
}
}Are any of Dlls missing?
See if you find asnwer here
http://support.businessobjects.com/