Showing results for 
Search instead for 
Did you mean: 

Override Driver from DBF file to SQL server, "Failed to load database info"

Former Member
0 Kudos

Hi there,

I've a crystal report that was loading DBF file, but I want to change the connection to SQL at run time via RAS, below is the code I found from the SAP forum, but I'm keep getting "Failed to load database info".. What could be wrong here?

Thank you,

CrystalDecisions.CrystalReports.Engine.ReportDocument myReport2 = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

protected void Page_Load(object sender, EventArgs e) {

try {

myReport2.Load( Server.MapPath( "CRDBase.rpt" ) );

ISCDReportClientDocument reportClientDocument = myReport2.ReportClientDocument;

ISCDReportClientDocument rcd;

rcd = reportClientDocument;

reportClientDocument.DatabaseController.LogonEx( "SQL2008R2", "CR", "smisreader", "pass@word1" );

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

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

logonDetails.Add( "Auto Translate", -1 );

logonDetails.Add( "Connect Timeout", 15 );

logonDetails.Add( "Data Source", "SQL2008R2" );

logonDetails.Add( "General Timeout", 0 );

logonDetails.Add( "Initial Catalog", "CR" );

logonDetails.Add( "Integrated Security", "false" );

logonDetails.Add( "Locale Identifier", 1033 );

logonDetails.Add( "OLE DB Services", -5 );

logonDetails.Add( "Provider", "SQLOLEDB" );

logonDetails.Add( "Use Encryption for Data", 0 );

logonDetails.Add( "Owner", "dbo" ); // schema

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

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

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

QE_Details.Add( "QE_DatabaseName", "CR" );

QE_Details.Add( "QE_DatabaseType", "OLE DB (ADO)" );

QE_Details.Add( "QE_LogonProperties", logonDetails );

QE_Details.Add( "QE_ServerDescription", "SQL2008R2" );

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

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

QE_Details.Add( "Owner", "dbo" );

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

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo oldConnInfo;

CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfos oldConnInfos;

oldConnInfos = rcd.DatabaseController.GetConnectionInfos( null );

for( int I = 0; I < oldConnInfos.Count; I++ ) {

oldConnInfo = oldConnInfos<i>;

newConnInfo.Attributes = QE_Details;

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

reportClientDocument.ReplaceConnection( oldConnInfo, newConnInfo, null, CrystalDecisions.ReportAppServer.DataDefModel.CrDBOptionsEnum.crDBOptionDoNotVerifyDB );


CrystalReportViewer2.ReportSource = myReport2;


catch( Exception ex ) {



Accepted Solutions (1)

Accepted Solutions (1)

Active Contributor
0 Kudos

See if using the utility described in the KB [1553921 - Is there a utility that would help in writing database logon code?|] will help.

Best way to use the above is to create a simple report using connection to SQL. Then run the report in the above utility and see the code generated.


Follow us on Twitter

Got Enhancement ideas? Try the [SAP Idea Place|]

Answers (0)