如何在C#中使用没有数据库的数据集打印RDLC [英] How to Print RDLC using Dataset without Database in C#

查看:112
本文介绍了如何在C#中使用没有数据库的数据集打印RDLC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序可以打印文本框内的每个数据。所以这意味着我没有数据库



我使用RDLC来完成打印过程。我将每个文本框的参数设置到我的报告中,并添加此代码,以便将文本框的文本传输到报告中。 (我的表单中有10个文本框)



 ReportParameter textbox1param =  new  ReportParameter(  textbox1,textbox1.Text); 
printform.reportViewer1.LocalReport.SetParameters(textbox1param);





我的问题是,当我这样做时,它会使我的系统在打印时崩溃,因为我多次重复此代码只是为了传输表单中的每个文本框的文本。 (我重复代码10次只更改文本框的名称和参数名称。)



我看到有另一种方法正在使用数据集。我的问题是我不使用数据库,因为我只是打印用户输入的屏幕中的内容。所以我无法为它创建查询。我有什么其他方法可以解决这个难题吗?谢谢你们!

解决方案

Lucas Juan写道:

我看到有另一种使用数据集的方法。我的问题是我不使用数据库,因为我只是打印用户输入的屏幕中的内容。所以我无法为它创建查询。我还有其他方法可以解决这个难题吗?

您可以使用数据集。要过滤值,请使用参数字段。检查这些

绑定数据集和Generic * .rdlc在运行时向ReportViewer报告 [ ^ ]

使用Microsoft Report(RDLC)导出到Word / PDF而不使用报表查看器 [ ^ ]

http://gotreportviewer.com/ [ ^ ]


I have an app that will print every data that is inside of the textboxes. So it means that I don't have database

I use a RDLC to fulfill the printing process. I set up parameters per textbox to my report and add this code so that the textboxes' text will be transferred to the report. (I have 10 textboxes in my form)

ReportParameter textbox1param = new ReportParameter("textbox1", textbox1.Text);
printform.reportViewer1.LocalReport.SetParameters(textbox1param);



My problem though is when I do this way, it makes my system crash while printing because I repeat this code many times just to transfer every textboxes' text in my form. (I repeat the code 10 times only changing the textbox's name and the parameter name.)

I see that there is another method which is using dataset. My problem is I don't use a database because I just print what it is in the screen that the user inputted. So I can't create a query for it. Is there any other way for me to solve this dilemma? Thank you guys!

解决方案

Lucas Juan wrote:

I see that there is another method which is using dataset. My problem is I don't use a database because I just print what it is in the screen that the user inputted. So I can't create a query for it. Is there any other way for me to solve this dilemma?

You could use Dataset. To filter the values use parameter fields. Check these
Binding DataSet and Generic *.rdlc Reports to a ReportViewer at Runtime[^]
Exporting to Word/PDF using Microsoft Report (RDLC) without using Report Viewer[^]
http://gotreportviewer.com/[^]


这篇关于如何在C#中使用没有数据库的数据集打印RDLC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆