zoukankan      html  css  js  c++  java
  • 摘录的WinForm Control 开发5,WinForm 开发:RDLCCustomAssemblyAccessFS,报表开发,之自定义报表,自定义初始化

    1,报表设计:平常的rdlc报表,在设计时,要添加数据库数据源。这样必须绑定数据库。我这里做到了报表与数据库分离。
    在窗体中自己给报表初始化,给报表赋值。

    2,报表设计:新建报表Report1.rdlc,添加数据源,选择对象,选择Mode层的Person
    如图:

     

     3,设置报表的数据源,设计报表的界面,拖入表格,然后把Person对象的字段赋值到表里边。然后设置报表数据源


    菜单:报表/数据源,如图:

     

     修改报表的数据源的名称为:myds


    设置报表中表格的数据源名称:myds

     4,加载报表,在窗体设计器里拖入ReportView

    选择刚才的报表,然后删除界面自动加入的“*DataSource”


    5,然后是自己写的初始化报表的代码:

    代码
                List<Person> listPerson = new List<Person>();
                Person per 
    = new Person("123"25);
                listPerson.Add(per);
                DataSet orderSet 
    = new DataSet();
                orderSet 
    = DataSetHelper.ToDataSet<Person>(listPerson as IList<Person>);
                
    this.reportViewer.LocalReport.DataSources.Clear();
                
    //this.reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("myds", DataSetHelper.ToDataTable(listPerson as IList<Person>)));
                this.reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("myds",listPerson.ToArray<Person>()));
                
    this.reportViewer.RefreshReport();
  • 相关阅读:
    如何重新加载 Spring Boot 上的更改,而无需重新启动服务器?
    什么是 JavaConfig?
    序列号Sequences
    包Packages
    参数Parameters、变量Variables
    maven配置多个镜像
    各种http报错的报错的状态码的分析
    举例说明同步和异步。
    第二阶段的任务及燃尽图(第二天)
    第二阶段的任务及燃尽图(第一天)
  • 原文地址:https://www.cnblogs.com/csharponworking/p/1691996.html
Copyright © 2011-2022 走看看