Saturday, February 11, 2012
"craxdrt9.dll" version "9.2.3.1368" errors at runtime with multiple threads STA
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/
"Conversion failed when converting from a character string to uniqueidentifier."
This is probably a simple wuestion but i would appreciate some help
I am trying to get and insert theuserId into a table called "Orders"
I got the user id as
Dim CustomerId As Object = Membership.GetUser(User.Identity.Name).ProviderUserKey.ToString
The button on click command is
worldshop.ShoppingCart.CreateOrder(CustomerId,...................
The Function Has the parameter for Customer Id as follows
Dim dbParam_CustomerId As System.Data.IDataParameter = New System.Data.SqlClient.SqlParameter
dbParam_CustomerId.ParameterName = "@.CustomerId"
dbParam_CustomerId.Value = CustomerId
dbParam_CustomerId.DbType = System.Data.DbType.String
command.Parameters.Add(dbParam_CustomerId)
When i run this I am getting the error message
"Conversion failed when converting from a character string to uniqueidentifier."
Can anyone tell me where I am going wrong
many thanks
Martin
What type is CustomerID defined as in the database? It sounds like it is NOT a string, but rather a uniqueidentifier (a GUID).|||thanks for your reply. i got it sorted out
martin
|||Do you mind sharing with us what your solution was? as I am having the same problem...|||I'll check and get back to you
martin
|||sorry about the delay in getting back to you
I was having the same problem. I solved it by instantiating the userid as an object
Dim userId As Object = Membership.GetUser(User.Identity.Name).ProviderUserKey
i passed the object to the function as a guid
ByVal userId As Guid
Dim dbParam_userId As System.Data.IDataParameter = New System.Data.SqlClient.SqlParameter
dbParam_userId.ParameterName = "@.UserId"
dbParam_userId.Value = userId
dbParam_userId.DbType = System.Data.DbType.Guid
command.Parameters.Add(dbParam_userId)
last i put the guid into the database as char 36
@.UserId char (36)
HTH
