简体   繁体   English

C#-创建报告

[英]C# - Creating reports

Iam trying to create some reports in C# using report.rdlc. 我试图使用report.rdlc在C#中创建一些报告。 I want to create reports based on store procedures. 我想根据存储过程创建报告。 I want to show the data that store procedures return in textboxes. 我想在文本框中显示存储过程返回的数据。 For example textbox1 contains values from store procedure 1 and textbox2 contains values from store procedure 2 and so on. 例如,textbox1包含来自存储过程1的值,textbox2包含来自存储过程2的值,依此类推。

Is it possible to that? 有可能吗?

"Is it possible to that?" “有可能吗?” -- Yes, everything you've mentioned is possible. -是的,您提到的一切都是可能的。

You'll need to check out a tutorial or something. 您需要查看教程或其他内容。 You could start by taking a look at the FAQ on... http://www.gotreportviewer.com/ 您可以先查看以下网站上的常见问题解答: http://www.gotreportviewer.com/

but I'm sure there are hundreds of tutorials out there. 但我敢肯定有数以百计的教程在那里。 One approach could be: 一种方法可能是:

  1. create the stored procedure(s) to get your data from the DB. 创建存储过程以从数据库获取数据。
  2. create a dataset. 创建一个数据集。
  3. create a tableAdapter for each sproc you've created ( the tableAdapters will use the sprocs you created ). 为您创建的每个存储过程创建一个tableAdapter(tableAdapter将使用您创建的存储过程)。
  4. create the report itself. 创建报告本身。
  5. create a page with a reportViewer control. 创建一个带有reportViewer控件的页面。
  6. during page_load you'll need to have instances of the tableAdapters and call their GetData() functions. 在page_load期间,您将需要tableAdapter的实例并调用其GetData()函数。
  7. You'll then need to add the data datasources to the reportViewer control and call ReportViewer.Refresh(). 然后,您需要将数据数据源添加到reportViewer控件,并调用ReportViewer.Refresh()。

This isn't a complete list of steps but hopefully it gets you going in the right direction. 这不是完整的步骤列表,但希望它能使您朝正确的方向前进。 Best of Luck! 祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM