Skip to Content
0
May 26 at 06:21 AM

Crystal Report runtime Missing parameter values error after updating SQL provider programmatically

93 Views Last edit May 26 at 11:02 AM 3 rev

Due to TLS 1.2 support we have to upgrade SQL driver MSOLEDBSQL, crystal runtime version 13.0.30 SP 30 and crystal report developer 2016.

When I manually update the driver for report and subreport to MSOLEDBSQL using crystal report developer 2016 then it executes without any error on crystal report runtime 13.0.30 SP 30 (latest version)

But when I change the driver programmatically then it gives error Missing parameter values:

Stack trace : at CrystalDecisions.ReportAppServer.ConvertDotNetToErom.ThrowDotNetException(Exception e)

at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)

at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export(ExportOptions options)

Assembly version - 13.0.4000.0

Dll version -13.0.30.3805

Store proc used to fetch the data from SQL server and bind to report.

Note: Most of the repot is working with below code but some reports are failing. My assumption is that those report having formula and record selection linking between main report and subreport having problem. Please guide to resolve the issue.

Code to update the driver.

privatevoid SetTbl(ReportDocument rpt)

{

SqlConnectionStringBuilder scsb = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["ABC"].ConnectionString);

foreach (CrystalDecisions.ReportAppServer.DataDefModel.Table table in rpt.ReportClientDocument.DatabaseController.Database.Tables)

{

CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable newTable = table.Clone(true);

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo cnnRpt = newTable.ConnectionInfo;

PropertyBag PropertyBagRpt = cnnRpt.Attributes["QE_LogonProperties"];

PropertyBagRpt["Provider"] = "MSOLEDBSQL";

//PropertyBagRpt["Provider"] = "SQLNCLI11";

PropertyBagRpt["Data Source"] = scsb.DataSource;

PropertyBagRpt["Initial Catalog"] = scsb.InitialCatalog;

if (scsb.IntegratedSecurity)

PropertyBagRpt["Integrated Security"] = true;

else

{

PropertyBagRpt["Integrated Security"] = false;

PropertyBagRpt["User ID"] = scsb.UserID;

PropertyBagRpt["Password"] = scsb.UserID;

}

cnnRpt.Attributes["QE_LogonProperties"] = PropertyBagRpt;

cnnRpt.Attributes["Database DLL"] = "crdb_ado.dll";

cnnRpt.Attributes["QE_DatabaseName"] = scsb.InitialCatalog;

cnnRpt.Attributes["QE_ServerDescription"] = scsb.DataSource;

cnnRpt.Attributes["QE_SQLDB"] = true;

rpt.ReportClientDocument.DatabaseController.SetTableLocation(table, newTable);

}

foreach (ReportDocument subreport in rpt.Subreports)

{

foreach (CrystalDecisions.ReportAppServer.DataDefModel.Table table in rpt.ReportClientDocument.SubreportController.GetSubreportDatabase(subreport.Name).Tables)

{

CrystalDecisions.ReportAppServer.DataDefModel.ISCRTable newTable = table.Clone(true); ;

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo cnnRpt = newTable.ConnectionInfo;

PropertyBag PropertyBagRpt = cnnRpt.Attributes["QE_LogonProperties"];

PropertyBagRpt["Provider"] = "MSOLEDBSQL";

//PropertyBagRpt["Provider"] = "SQLNCLI11";

PropertyBagRpt["Data Source"] = scsb.DataSource;

PropertyBagRpt["Initial Catalog"] = scsb.InitialCatalog;

if (scsb.IntegratedSecurity)

PropertyBagRpt["Integrated Security"] = true;

else

{

PropertyBagRpt["Integrated Security"] = false;

PropertyBagRpt["User ID"] = scsb.UserID;

PropertyBagRpt["Password"] = scsb.UserID;

}

cnnRpt.Attributes["QE_LogonProperties"] = PropertyBagRpt;

cnnRpt.Attributes["Database DLL"] = "crdb_ado.dll";

cnnRpt.Attributes["QE_DatabaseName"] = scsb.InitialCatalog;

cnnRpt.Attributes["QE_ServerDescription"] = scsb.DataSource;

cnnRpt.Attributes["QE_SQLDB"] = true;

newTable.ConnectionInfo = cnnRpt;

rpt.ReportClientDocument.SubreportController.SetTableLocation(subreport.Name, table, newTable);

}

}

}