gpt4 book ai didi

c# - 报告中的自定义 c# 代码

转载 作者:行者123 更新时间:2023-11-30 22:00:31 25 4
gpt4 key购买 nike

我正在使用对象填充报告。一切正常,如果我的成员是字符串,但是,我有几个成员,它们是 List<string>

当我将这些字段添加到报告中(在设计师、visual studio 2012 中)并运行报告时,它们显示为

'#Error'

查看报告的属性,我可以看到有一个“自定义代码”选项卡,为此我输入了以下方法将字符串列表转换为字符串数组。

public string[] GetListItems(List<string> intList)
{
var s = intList.ToArray();
return s;
}

然后,当我尝试用表达式替换该字段并输入以下内容时:

=Join(Code.GetListItems(Fields!Aka.Value),",")

然后运行报告,VS 无法使用以下内容构建:

Error 2 The Value expression for the textrun ‘Aka.Paragraphs[0].TextRuns[0]’ contains an error: [BC30456] 'GetListItems' is not a member of 'ReportExprHostImpl.CustomCodeProxy'.

Error 1 There is an error on line 0 of custom code: [BC30183] Keyword is not valid as an identifier.

谁能解释这是为什么?

最佳答案

那是 C# 代码。直接在报表中只能使用 Visual Basic。 C# 可用作外部 DLL。

关于c# - 报告中的自定义 c# 代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28477195/

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