Skip to Content
0
Former Member
Apr 03, 2013 at 09:41 AM

VerifyDatabase throws exception as "No Error". DB Oracle, SubReports problem

41 Views

Hi,

I am working in migrating from CR11 to CR13 . I have created UFL (User function lib) in .Net.

Now some reports which have subreports in them dont work fine in case of ORACLE database. Things are working fine in case of SQL database in background.

Some more details are,

RPT file is developed with SQL.

This report works fine with SQL database.

Report has three subreports.

In case of ORACLE if there are no subreports then report is displayed properly.

I am using below code for Replace connection,

CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument reportClientDocument;

reportClientDocument = new CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper();

reportClientDocument = rptDoc.ReportClientDocument;

reportClientDocument.DatabaseController.LogonEx(strDSN, strDatabaseName, strUserID, strPassword);

//Create the logon propertybag for the connection we wish to use

CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag objlogonDetails = new CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag();

//Create the QE (query engine) propertybag with the provider details and logon property bag.

CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag objMainPropertyBag = new CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag();

if (m_bSqlServer)

{

objMainPropertyBag.Add("Database DLL", "crdb_odbc.dll");

objMainPropertyBag.Add("QE_DatabaseName", strDatabaseName);

objMainPropertyBag.Add("QE_SQLDB", "True");

}

else

{

objMainPropertyBag.Add("Server", strDSN);

//objMainPropertyBag.Add("Database DLL", "crdb_oracle.dll");

objMainPropertyBag.Add("Database DLL", "crdb_ado.dll");

objMainPropertyBag.Add("QE_DatabaseName", strDatabaseName);

objMainPropertyBag.Add("QE_SQLDB", "False");

}

objMainPropertyBag.Add("QE_DatabaseType", "ODBC (RDO)");

objMainPropertyBag.Add("QE_LogonProperties", objlogonDetails);

objMainPropertyBag.Add("QE_ServerDescription", strDSN);

objMainPropertyBag.Add("SSO Enabled", "False");

objlogonDetails.Add("UseDSNProperties", true);

if (m_bSqlServer)

{

objlogonDetails.Add("PreQEDatabaseName", strDatabaseName);

objlogonDetails.Add("PreQEServerName", strDSN);

objlogonDetails.Add("Trusted_Connection", "False");

}

else

{

objlogonDetails.Add("DSN", strDSN);

objlogonDetails.Add("PreQEServerName", strDSN);

objlogonDetails.Add("Trusted_Connection", false);

objMainPropertyBag.Add("Owner", strUserID);

}

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo objNewConnInfo = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo objOldConnInfo;

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfos objOldConnInfos;

objOldConnInfos = reportClientDocument.DatabaseController.GetConnectionInfos();

for (int i = 0; i < objOldConnInfos.Count; i++)

{

objOldConnInfo = objOldConnInfos[i];

objNewConnInfo.Attributes = objMainPropertyBag;

objNewConnInfo.Password = strPassword;

objNewConnInfo.UserName = strUserID;

objNewConnInfo.Kind = CrystalDecisions.ReportAppServer.DataDefModel.CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;

reportClientDocument.DatabaseController.ReplaceConnection(objOldConnInfo, objNewConnInfo, null, CrystalDecisions.ReportAppServer.DataDefModel.CrDBOptionsEnum.crDBOptionDoNotVerifyDB);

foreach (string strSubreportsName in reportClientDocument.SubreportController.GetSubreportNames())

{

CrystalDecisions.ReportAppServer.Controllers.ISCRSubreportClientDocument oSubReportClientDocument = reportClientDocument.SubreportController.GetSubreport(strSubreportsName);

oSubReportClientDocument.DatabaseController.LogonEx(strDSN, strDatabaseName, strUserID, strPassword);

oSubReportClientDocument.DatabaseController.ReplaceConnection(objOldConnInfo, objNewConnInfo, null, CrystalDecisions.ReportAppServer.DataDefModel.CrDBOptionsEnum.crDBOptionDoNotVerifyDB);

}

}

//For each table in main report

foreach (CrystalDecisions.ReportAppServer.DataDefModel.Table oTableOld in reportClientDocument.Database.Tables)

{

CrystalDecisions.ReportAppServer.DataDefModel.Table oTableNew = GetNewTable(oTableOld, objNewConnInfo, strDatabaseName);

reportClientDocument.DatabaseController.SetTableLocation(oTableOld, oTableNew);

oTableNew = null;

}

//For Subreports

foreach (string strSubreportsName in reportClientDocument.SubreportController.GetSubreportNames())

{

//Loop through each table in subreport database and set its new table

foreach (CrystalDecisions.ReportAppServer.DataDefModel.Table objTableOld in reportClientDocument.SubreportController.GetSubreportDatabase(strSubreportsName).Tables)

{

CrystalDecisions.ReportAppServer.Controllers.ISCRSubreportClientDocument oSubReportClientDocument = reportClientDocument.SubreportController.GetSubreport(strSubreportsName);

CrystalDecisions.ReportAppServer.DataDefModel.Table objTableNew = GetNewTable(objTableOld, objNewConnInfo, strDatabaseName);

reportClientDocument.SubreportController.SetTableLocation(strSubreportsName, objTableOld, objTableNew);

bool bVerify = oSubReportClientDocument.DatabaseController.VerifyTableConnectivity(objTableNew);

objTableNew = null;

}

}

reportClientDocument.VerifyDatabase();

When there are subreports in rpt file and when we use ORACLE in that case VerifyDatabase() function throws exception as "No error"

Thanks in advance.