Symptom
How to find the properties of the database and the tables used in the Crystal Reports using inProc RAS .NET SDK
Environment
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