分类目录

链接

2012 年 3 月
 1234
567891011
12131415161718
19202122232425
262728293031  

近期文章

热门标签

新人福利,免费薅羊毛

现在位置:    首页 > .NET > 正文
fastreport中显示两个数据集
.NET 暂无评论 阅读(5,159)

最近由于业务需要使用FastReport打印两个表,可以用ROW DATASOURCE只能打一个表,

想了很久都没找到解决办法。

最后发现添加两个Child子报表,再在子报表里添加TABLE就OK了!

再给TABLE里绑定数据就OK了!

绑定方法如下:

1、给TABLE添加一个事件

2、

  1. private void Table1_ManualBuild(object sender, EventArgs e)
  2.     {
  3.       // get the data source by its name
  4.       DataSourceBase rowData = Report.GetDataSource("Products");
  5.       // init the data source
  6.       rowData.Init();
  7.       
  8.       // print the first table row - it is a header
  9.       Table1.PrintRow(0);
  10.       // each PrintRow call must be followed by either PrintColumn or PrintColumns call
  11.       // to print cells on the row
  12.       Table1.PrintColumns();
  13.       
  14.       // now enumerate the data source and print the table body
  15.       while (rowData.HasMoreRows)
  16.       {
  17.         // print the table body  
  18.         Table1.PrintRow(1);
  19.         Table1.PrintColumns();
  20.         
  21.         // go next data source row
  22.         rowData.Next();
  23.       }
  24.       
  25.       // print the last table row - it is a footer
  26.       Table1.PrintRow(2);
  27.       Table1.PrintColumns();
  28.     }

 

============ 欢迎各位老板打赏~ ===========

本文版权归Bruce's Blog所有,转载引用请完整注明以下信息:
本文作者:Bruce
本文地址:fastreport中显示两个数据集 | Bruce's Blog

发表评论

留言无头像?