如何将字符串值(字符串列表)传递给参数以在Crystal Report中显示多个值

时间:2019-03-07 15:19:26

标签: c# crystal-reports

我正在一个wpf应用程序上,我想将一个字符串列表(多个字符串值)传递给Crystal Report单个参数,以在Crystal Reports的第3节中显示多个值。我将参数的Allow Multiple values设置为True。 我用谷歌搜索,但找不到解决方法。

我已经尝试过了,但是它给出了一个异常“ System.ArgumentException:'无效的对象类型'。”

crystalReport obj2 = new crystalReport();
obj2.Load("@crystalReport.rpt");

foreach (string x in list)
{

obj2.ParameterFields["stringParameter"].CurrentValues.Add(x); //exception 

}

我也尝试过这个。它给出了一个异常“ System.ArgumentException:'值不在预期范围内。'”

crystalReport obj2 = new crystalReport();
obj2.Load("@crystalReport.rpt");

obj2.SetParameterValue("stringParameter", list); // exception

0 个答案:

没有答案
相关问题