1692334 - How to find the properties of the Database and the Table used in the Crystal Reports using inProc RAS .NET SDK

SAP Knowledge Base Article - Public

1692334 - How to find the properties of the Database and the Table used in the Crystal Reports using inProc RAS .NET SDK

Symptom

How to find the properties of the database and the tables used in the Crystal Reports using inProc RAS .NET SDK

Environment

  • Crystal Reports 2008
  • Crystal Reports .NET SDK
  • Report Application Server (RAS) SDK 
  • Resolution

    Following code can help you achieve the objective:

    ReportDocument rd = new ReportDocument();
    rd.Load(Server.MapPath("CrystalReports.rpt"));
    ISCDReportClientDocument rcd = rd.ReportClientDocument;
    DatabaseController databaseController = rcd.DatabaseController;

    CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo connectionInfo = databaseController.FindConnectionInfoByDBServerName("DatabaseName");
    PropertyBag oldPb = connectionInfo.Attributes;

      foreach (String attribute in oldPb.PropertyIDs)
       {
         if (oldPb[attribute].ToString().Equals("System.__ComObject"))
          {
             Response.Write(attribute + " (" + oldPb[attribute].GetType().ToString() + ") = <br>");
             PropertyBag oldLogonPb = (PropertyBag)oldPb[attribute];
             foreach (String logonAttribute in oldLogonPb.PropertyIDs)
                    {
                        Response.Write(logonAttribute + " = " + oldLogonPb[logonAttribute].ToString() + " (" + oldLogonPb[logonAttribute].GetType().ToString() + ")<br>");
                    }
                }
                else
                {
                    Response.Write(attribute + " = " + oldPb[attribute].ToString() + " (" + oldPb[attribute].GetType().ToString() + ")<br>");
                }
            }

            CrystalDecisions.ReportAppServer.DataDefModel.Tables tables = databaseController.Database.Tables;
            CrystalDecisions.ReportAppServer.DataDefModel.Table customerTable = (CrystalDecisions.ReportAppServer.DataDefModel.Table)tables.FindTableByAlias("Sales_by_Category");
            Response.Write("Owner" + " = " + customerTable.QualifiedName + " <br>");

    Keywords

    BO , table , RCD , Reports , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

    Product

    Crystal Reports 2008 V0 ; Crystal Reports 2008 V1 ; SAP Crystal Reports, version for Visual Studio .NET 2008