需要获取RDLC报告上的参数帧
我正在构建一个 Winforms (.NET) 应用程序。
假设我有 10 个具有不同参数的 RDLC 报告。我是否需要创建 10 个屏幕(表单)来获取各个报告的参数,以便我可以执行基础数据集的 Fill 方法。
是否有任何(免费)工具可以使这项工作变得更容易。
或者我错过了一些已经存在的东西?
总而言之......我计划拥有一种带有报表查看器控件的表单,它可用于显示不同的报表,并且它可以负责收集参数和执行报表。这样我只需要传递带有报告名称的表格即可。
注意:我知道服务器报告(RDL)可以做到这一点,但我没有用于该项目的报告服务器。
请帮忙。
I'm building a Winforms (.NET) application.
Suppose I have 10 RDLC Reports with different parameters. Do I need to create 10 Screens (Forms) to get parameters for respective reports so that I can execute the underlying DataSet's Fill method.
Is there any (free) tool that is available to make this job easier.
Or am I missing something, that is out there already ?
To sum up... I'm planning to have one form with reportviewer control which can be used to show different reports and it can take care of collecting the params and executing the reports. So that all I need to pass the form with just the report name.
Note: I know a server report (RDL) could do this, but I dont have a Report Server for this project.
Please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据我的其他答案的评论,我不知道有任何这样的工具,因为很多报告可以有如此不同的标准,并且他们从中查询的表/列可能不实用。我已经用另一种语言完成了,我可以对诸如选择日期范围(从/到)之类的事情进行通用控制,并让它生成并返回 WHERE 子句的该部分。类似地,比如排序,有一个带有显示值的组合框,但内部键值将表示 where 子句中的 order by 子句。然后,拥有一个包含这些元素的通用用户控件容器将有助于标准化用户界面如何选择这些元素(也许还有其他常见元素)。然后在类上有一个通用的虚拟方法,例如“GetMyData()”,该控件可以根据需要为任意数量的实例/报告进行子类化,每个实例/报告都知道如何处理呈现给用户的查询组件,并且实际上获取最终输出的代表性数据。
Per comment from my other answer, I don't know of any such tool as so many reports can have such diverse criteria and table/columns they query from it might not be practical. I have done in another language where I would have common controls for things like picking date range (from/to), and having it generate and return that portion of my WHERE clause. Similarly, such as sorting, having a combobox built with a display value, but the internal key value would represent the order by clause in the where clause. Then, having a common user control container with these elements would help standardize how the user interface would be able to pick these (and maybe others that are common). Then have a generic virtual method on the class, such as "GetMyData()", the control can be sub-classed for as many instances / reports as you need, each of them knowing how to handle the querying components presented to the user and actually getting the representative data for final output.
我实际上已经在应用程序中完成了此操作。但是,不必担心要传递哪些参数并超级重载我的报告类的构造函数对象。它只有一个“ReportViewer”实例作为我使用的对象。
然后,我将公开一些公共方法,每个报告都需要一个公共方法,根据需要需要不同的参数,但如果通用则传递一个数据集,其中包含用于报告的一个或多个表。然后,我将动态循环遍历表格并添加到报表查看器控件
}
现在,要实际调用它并将它们放在一起...
我已经剥离了一堆其他验证 try/catch 等,并剥离了特定的对象引用来自我的实际代码,但下面的模板应该会给您一个巨大的启动。
I've actually done this in an app. However, Instead of worrying about which parameters to pass and super overloading a Constructor object of my reporting class. It just has an instance of the "ReportViewer" as an object on it that I work with.
Then, I'll expose some public methods, one for each report that requires different parameters as needed, but if generic being passed a data set with one or more tables within it for the report. I'll then dynamically cycle through the tables and add to the report viewer control
}
Now, to actually CALL this and put it all together...
I've stripped a bunch of other validation try/catch, etc and stripped specific object references from my actual code, but the template below should give you a tremendous jumpstart.