最简单的方法从C#传递参数到Crystal Report?(Easiest way to pass parameters to Crystal Report from C#?)

485 IT屋

I'm learning how to pass parameters to a Crystal Report from a C# asp.net webform. I've found one way to pass parameters, but its 6 lines of code per parameter. Can anyone suggest a simpler way to pass parameters (both discrete and range) to the report?

解决方案

Here's a question and answer I had that addresses this question:

Crystal Reports "File Break"

Out of the code that I posted in the answer, here's what I think is relevant to your problem:

private readonly CrystalReportViewer reportViewer = new CrystalReportViewer();
...
    crystalReport.Load(this.reportViewer.ReportSource.ToString());

    crystalReport.SetParameterValue("customerId", customerId);
    crystalReport.SetParameterValue("isCurrent", isCurrent);
    crystalReport.SetParameterValue("TotalSales", totalSales);

Good luck!

我正在学习如何从C#asp.net webform传递参数到Crystal Report。我发现了一种方法来传递参数,但每个参数的6行代码。任何人都可以建议一个更简单的方法来传递参数(离散和范围)到报告?


解决方案

遇到了这个问题:



水晶报表" File Break"



在我在答案中发布的代码中,以下是我认为与您的问题相关的代码:



  private readonly CrystalReportViewer reportViewer = new CrystalReportViewer(); 
...
crystalReport.Load(this.reportViewer.ReportSource.ToString());

crystalReport.SetParameterValue("customerId",customerId);
crystalReport.SetParameterValue("isCurrent",isCurrent);
crystalReport.SetParameterValue("TotalSales",totalSales);


祝你好运!


本文地址:IT屋 » 最简单的方法从C#传递参数到Crystal Report?