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();
  • 相关阅读:
    解决Firefox下outerHTML不支持问题
    神奇的css属性pointerevents
    IE6 double marginleft Bug
    解决IE低版本不支持call和apply问题
    JavaScript函数参数的可修改性
    IE6/7 double paddingbottom Bug
    各浏览器对document.getElementById等方法的实现差异
    JavaScript中两种类型的全局对象/函数
    JavaScript子类用Object.getPrototypeOf去调用父类方法
    JavaScript声明全局变量三种方式的异同
  • 原文地址:https://www.cnblogs.com/csharponworking/p/1691996.html
Copyright © 2011-2022 走看看