gpt4 book ai didi

c#-2.0 - SSRS 和访问 C# 方法

转载 作者:行者123 更新时间:2023-12-02 08:58:20 24 4
gpt4 key购买 nike

想知道 C# 汇编中的方法是否需要静态才能从 SSRS 访问?

最佳答案

不,您可以在 C# 类库中使用公共(public)方法和静态方法,并从 SSRS 报告中引用它们。

不过,您确实需要以与公共(public)实例方法不同的方式添加静态方法。你应该看看这个MS article关于 SSRS 中自定义代码的使用。以下是如何添加静态方法的要点:

The Classes section is only forinstance-based members. It is not forstatic members. Static (also referredto as "shared" in some of ourReporting Services documentation)means that the member is available toevery instance of the class and everyinstance uses the same storagelocation. Static members are declaredby using the shared keyword inMicrosoft Visual Basic and the statickeyword in C#. This can be a bitconfusing. What this means is, if yourcustom assembly contains instancemembers that you need to access, youwill have to specify the class nameand instance name in the Classessection. Because the method I will becalling from Reporting Services wasdefined as static by using the sharedkeyword in Visual Basic, I'll use theReferences section instead of theClasses section.

因此,如果您想要执行实例方法,请确保添加引用,但还要在类中指定“类”“实例名称”您需要的每种方法的“报告属性”部分。然后使用 =Code 表达式调用它们。就像这样:

=Code.InstanceName.Method

希望对您有所帮助。

关于c#-2.0 - SSRS 和访问 C# 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3160304/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com