cancel
Showing results for 
Search instead for 
Did you mean: 

Update all Crystal Reports DB connection's in Business Objects using .net sdk

Former Member
0 Kudos

Hi,

First off, I am new to this forum. I need to update the database configuration properties for a bulk of my crystal reports in BO 4.x. Specifically,

I need to change the database type, server, user, password, data source, etc... Also, I would like to change the default setting for these reports as well. What is the best way to go about doing this without having to go into each one individually? is using the .net sdk the best way? windows form application?

Thanks,

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Actually, to start off, I would like to know how to change the data source from an odbc connection to a native oracle connection for my crystal reports without having to go to each one individually.

DellSC
Active Contributor
0 Kudos

Here's a sample of code from a class that I wrote for adding and updating reports in BO:

Get the report to be updated

 

    private void updRpt(string rptFile, string alias, string rptDescrip, int folderID)

    {

      string query = "Select * from CI_INFOOBJECTS where SI_ID = " + _rptID.ToString();

      using (InfoObjects io = _common.BOEInfoStore.Query(query))

      {

        if (io.Count > 0)

        {

          Report newRpt = (Report)io[1];

          updateLogon(newRpt, alias);

          newRpt.Save();

        }

        else

        {

          _errMsg = "Unable to update report: Report Not Found";

        }

      }

    }

Change the DB Logon

    private void updateLogon(Report newRpt, string alias)

    {

      for (int j = 1; j <= newRpt.ReportLogons.Count; j++)

      {

        //set the database alias, user ID, and password

        newRpt.ReportLogons[j].UseOriginalDataSource = false;

        newRpt.ReportLogons[j].CustomServerName = alias;

        newRpt.ReportLogons[j].CustomUserName = _rptUser;

        newRpt.ReportLogons[j].CustomPassword = _rptPW;

        if (_setPrefix)  //needed for Oracle database but maybe not others

        {

          for (int l = 1; l <= newRpt.ReportLogons[j].TableLocationPrefixes.Count; l++)

          {

            newRpt.ReportLogons[j].TableLocationPrefixes[l].UseMappedTablePrefix = true;

            newRpt.ReportLogons[j].TableLocationPrefixes[l].MappedTablePrefix = _rptPrefix;

          }

        }

        //if necessary, set the database driver

        if (_updateDriver && (_dbDriver != DBDrivers.SQL_Server))

        {

          switch (_dbDriver)

          {

            case DBDrivers.Oracle:

              newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeOracle;

              break;

            case DBDrivers.DB2:

              newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeDB2;

              break;

            case DBDrivers.ADO:

              newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeUserSpecified;

              newRpt.ReportLogons[j].CustomDatabaseDLLName = "crdb_ado.dll";

              break;

            case DBDrivers.BTrieve:

              newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeUserSpecified;

              newRpt.ReportLogons[j].CustomDatabaseDLLName = "crdb_p2bbtrv.dll";

              break;

            case DBDrivers.ODBC:

              newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeUserSpecified;

              newRpt.ReportLogons[j].CustomDatabaseDLLName = "crdb_odbc.dll";

              break;

            case DBDrivers.OLAP:

              newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeUserSpecified;

              newRpt.ReportLogons[j].CustomDatabaseDLLName = "crdb_olap.dll";

              break;

            case DBDrivers.XML:

              newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeUserSpecified;

              newRpt.ReportLogons[j].CustomDatabaseDLLName = "crdb_xml.dll";

              break;

          }

        }

      }

    }

-Dell

Former Member
0 Kudos

Dell,

Thank you for that information as I am new to using the .net SDK. How do I establish a connection to SAP Business Objects CMC to make the necessary changes to the reports? I am currently using SAP BO 14.1.0. and I have installed visual studio 2013 and the .net sdk as well.

Thanks,

DellSC
Active Contributor
0 Kudos

If you go to my website:  www.dellstinnett.com/sample_code.html, look for the BOECommonInfo assembly or one of the tutorial programs.  All of those will show you how to log in to BO.

-Dell

Former Member
0 Kudos

The sample code is not working, missing CrystalDecisions.Enterprise.Desktop.Folder dll.