如何使用.NET code,以获得一个水晶报表文件的Oracle包名称如何使用、报表、水晶、名称

2023-09-07 00:18:07 作者:我有我的Feel

我想获得用于使用.NET code Crystal报表数据源Oracle包名称。 我获得的程序名,但由于某些原因,我无法找到包的名字。

I'm trying to obtain the Oracle package name used for a Crystal report data source using .NET code. I have obtained the procedure name, but for some reason I can not find the package name.

     Dim rpt as new ReportDocument
     rpt.Load(filename)

     Dim procedureName As String = rpt.Database.Tables.Item(0).Location 
     Dim DataSourceAliasName As String = rpt.Database.Tables.Item(0).Name

目前使用.NET的Crystal Decisions版本:10.5.3700.0

Currently using .NET Crystal Decisions version: 10.5.3700.0

推荐答案

该QualifiedName的属性没有暴露在公众的dotnet包装。你要访问非公有制基础COM对象,并使用它。

The QualifiedName attribute is not exposed on the public dotnet wrapper. You have to access the non-public underlying COM object and use that.

您需要参考下列DLL:

You need to reference the following DLLs:


CrystalDecisions.CrystalReports.Engine
CrystalDecisions.ReportAppServer.DataDefModel

下面是一个例子code段。请注意,它会回来pfixed模式名$ P $。最后我砍了关我的真正实施。

Below is an example code snippet. Note that it will come back prefixed with the schema name. I ended up chopping that off in my real implementation.

using System;
using System.Reflection;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.ReportAppServer.DataDefModel;

namespace ConsoleApplication1
{
   class Program
   {
      static void Main(string[] args)
      {
         ReportDocument doc = null;
         CrystalDecisions.CrystalReports.Engine.Table table = null;
         PropertyInfo prop = null;
         ISCRTable rasTable = null;

         doc = new ReportDocument();
         doc.Load("c:\\workspace\\temp\\example.rpt");
         table = doc.Database.Tables[0];

         prop = table.GetType().GetProperty("RasTable",BindingFlags.NonPublic | BindingFlags.Instance);
         rasTable = (ISCRTable)prop.GetValue(table, null);

         Console.Out.WriteLine(table.Name);    
         Console.Out.WriteLine(rasTable.QualifiedName);

      }
   }
}
 
精彩推荐
图片推荐