zoukankan      html  css  js  c++  java
  • fastreport代码转

    2016-07-08

    //打印主从表数据
    string file = Application.StartupPath @"MasterDetail.frx";
    rptMasterDetail.Load(file);//加载报表模板文件

    DataSet ds = DAL.GetMasterDetailData();//取报表数据

    rptMasterDetail.RegisterData(ds.Tables[0], "tb_SO"); //注册数据源,主表
    rptMasterDetail.RegisterData(ds.Tables[1], "tb_SOs"); //注册数据源,从表

    //
    //直接注册DataSet也行,但必须对DataSet.Tables指定表名!
    //FastReport是跟据表名取DataTable对象的。
    //
    //rptMasterDetail.RegisterData(ds);
    //

    //给DataBand(主表数据)绑定数据源
    DataBand masterBand = rptMasterDetail.FindObject("Data1") as DataBand;
    masterBand.DataSource = rptMasterDetail.GetDataSource("tb_SO"); //主表

    //给DataBand(明细数据)绑定数据源
    DataBand detailBand = rptMasterDetail.FindObject("Data2") as DataBand;
    detailBand.DataSource = rptMasterDetail.GetDataSource("tb_SOs"); //明细表

    //重要!!给明细表设置主外键关系!
    detailBand.Relation = new Relation();
    detailBand.Relation.ParentColumns = new string[] { "SONO" };
    detailBand.Relation.ParentDataSource = rptMasterDetail.GetDataSource("tb_SO"); //主表
    detailBand.Relation.ChildColumns = new string[] { "SONO" };
    detailBand.Relation.ChildDataSource = rptMasterDetail.GetDataSource("tb_SOs"); //明细表

    //准备工作,显示报表预览窗体
    rptMasterDetail.Prepare();
    rptMasterDetail.ShowPrepared(true, this);

  • 相关阅读:
    状态机的常见问题
    基于quartus的高级时序分析
    FPGA中的时钟域问题
    quartus中的时序约束常用方法
    时序约束与时序分析
    FPGA的PCB设计
    AXI4的主机协议代码分析
    selenium 笔记 场景判断
    Codeforces Round #676 (Div. 2) XORwice、Putting Bricks in the Wall、Palindromifier
    Trap HDU
  • 原文地址:https://www.cnblogs.com/lhyqzx/p/5652735.html
Copyright © 2011-2022 走看看