1 Reply Latest reply: Aug 27, 2013 11:35 PM by Ludek Uher RSS

Dynamic Connectivity with Oracle

Kiran Diwan
Currently Being Moderated

I have created report using crystal report 11, in visual studio when try to see preview it show me all the records. But when I try it with different database using crystal report viewer control, it gives an error "Database logon failed".


I have used below given code to change database connectivity.


private static void ChangeDataSource(ISCDReportClientDocument rcd, CrystalConnectionInfo crystalConnectionInfo)

        {

            DatabaseController databaseController = rcd.DatabaseController;

            ConnectionInfos connectionInfos = databaseController.GetConnectionInfos(null);

            CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo oldConnectionInfo = connectionInfos[0];

            CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo newConnectionInfo = new       

             CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();

            newConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;

            PropertyBag QELogonProperties = new PropertyBag();

            QELogonProperties.Add("Server", crystalConnectionInfo.ServerName);

            QELogonProperties.Add("Trusted_Connection", false);

            PropertyBag QEProperties = new PropertyBag();

            QEProperties.Add("QE_LogonProperties", QELogonProperties);

            QEProperties.Add("Database DLL", "crdb_oracle.dll");

            QEProperties.Add("QE_DatabaseName", crystalConnectionInfo.Database);

            QEProperties.Add("QE_DatabaseType", "Oracle Server");

            QEProperties.Add("QE_ServerDescription", crystalConnectionInfo.ServerName);

            QEProperties.Add("QE_SQLDB", true);

            QEProperties.Add("SSO Enabled", false);

            newConnectionInfo.Attributes = QEProperties;

            newConnectionInfo.UserName = crystalConnectionInfo.UserName;

            newConnectionInfo.Password = crystalConnectionInfo.Password;

            databaseController.ReplaceConnection(oldConnectionInfo, newConnectionInfo, null, (int)CrDBOptionsEnum.crDBOptionUseDefault +

               (int)CrDBOptionsEnum.crDBOptionDoNotVerifyDB);

        }

In Report I have directly used command in place of Table or Stored procedures.



Please find below given list of used tools.


Crystal Report - 11

Visual Studio - 2012

Oracle Server - 9i

Oracle Client - 11g

Actions