星空外围足球网(

logo FastReport中文文档

示例 6.使用数据源


 在所有示例中,我们都打印了一个包含普通文本的表格。在本示例中,我们将演示如何使用数据源创建表格。为此,我们将创建一个格式如下的表格:

我们将创建 ManualBuild 事件处理程序,它将执行以下操作:

  • 获取报告中定义的数据源。
  • 初始化(填充数据)。
  • 打印表格行数,打印次数与数据源中的行数相同。

以下是处理程序的代码:

private void Table1_ManualBuild(object sender, EventArgs e)
{
  // get the data source by its name
  DataSourceBase rowData = Report.GetDataSource("Products");
  // initialize it
  rowData.Init();

  // printing the table header
  Table1.PrintRow(0);
  Table1.PrintColumns();

  // loop through the data source rows
  while (rowData.HasMoreRows)
  {
    // printing the table row 
    Table1.PrintRow(1);
    Table1.PrintColumns();

    // select the next data row
    rowData.Next();
  }

  // printing the table footer
  Table1.PrintRow(2);
  Table1.PrintColumns();
}

如果我们运行该报告,会得到以下结果:

扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP
188BET体育网(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 永利网上滚球(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 博鱼信誉足球大全(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 盛凯国际网上盘口(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 半岛真人十大入口(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 腾曜集团最大足球网址(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 网络知名boyu·博鱼盘口(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新) 朗驰娱乐网上(官方)网站/网页版登录入口/手机版登录入口-最新版(已更新)