您的位置:首页 > 编程语言 > ASP

vs2013下, asp.net mvc5 使用和发布rdlc报表的步骤 ,使用ef来获取数据

2015-11-02 13:13 501 查看
1.右键项目,添加 新建项-》数据-》数据集

2.使用sql语句建立数据集,尽量包含所有的字段

3.右键项目 ,添加报表,设计报表,然后添加数据集

4.在controll中,

LogisticsDbContext db = new LogisticsDbContext();

var e = from p in db.instocks

。。。。。。

select new

{

。。。。。。

};

byte[] renderedBytes;

string mimeType;

string path = Server.MapPath("~/Report/Report1.rdlc");

renderedBytes = PublicHelper.PrintReport(path, e, out mimeType); //很多地方可以搜到类似的代码

return File(renderedBytes, mimeType);

就可以了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: