水晶报表使用IEnumerable<T>数据源

这篇我们学习水晶报表,报表呈现的数据源是IEnumerable<T>。比如下面的数据:

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Insus.NET.Models;

namespace Insus.NET.Entities
{
    public class MachineEntity
    {
        public IEnumerable<Machine> Machines()
        {
            return new List<Machine>()
            {
                { new Machine() {
                    Key =1,
                    ModelNumber ="TC03Q",
                    Brand ="QT",
                    ManufactureDate = Convert.ToDateTime("2008/12/31")}
                },
                { new Machine() {
                    Key =2,
                    ModelNumber ="MH26U",
                    Brand ="HW",
                    ManufactureDate = Convert.ToDateTime("2012/03/09")}
                },
                { new Machine() {
                    Key =3,
                    ModelNumber ="DW569",
                    Brand ="XM",
                    ManufactureDate = Convert.ToDateTime("2015/07/25")}
                }
            };
        }
    }
}
Source Code

 

新建水晶报表:

 

 

 

 

 

 

按Next铵钮,略过Group By。

 

铵Next铵钮,略过Filter Fields。

 

 

报表创建OK。

 

根据这篇《ASP.NET MVC项目实现BasePage基类用作ASPX.CS网页继承https://www.cnblogs.com/insus/p/9865023.html

我们还得在BasePage基类中,重载另一个方法:

 

在.aspx.cs网页中,就可以使用上面的方法:

 

 

程序运行:

 

学习完毕。

希望对你有所帮助。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值