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);
就可以了
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);
就可以了
相关文章推荐
- Asp.net中的页面跳转及post数据
- CS1061: “ASP.send_aspx”不包含“sender_TextChanged”的定义,并且找不到可接受类型为“ASP.send_aspx”的第一个参数的扩展方法“sender_Text
- 玩转树莓派--树莓派准备工作
- asp.net报错“尝试读取或写入受保护的内存。这通常指示其他内存已损坏”的解决办法
- asp.net报错“尝试读取或写入受保护的内存。这通常指示其他内存已损坏”的解决办法
- asp.net中“从客户端中检测到有潜在危险的Request.Form值”错误的解决办法
- ASP.NET如何使用web服务的会话状态
- asp.net 错误提示:Could not load type 'SendEmail.WebPage'
- asp.net 页面上的点击事件
- asp.net:repeater嵌套(常用于新闻等在首页归类显示)
- ASP.Net在web.config中设置上传文件的大小方法
- ASP.Net中的四种状态保持机制
- 深入理解asp.net SessionState
- ASP.NET之Gridview图解
- asp.net微信公众平台开发的技术研究
- ASP.Net传参汇总
- asp.net之简易聊天室
- asp.net中gridview的checkbox使用总结
- 16、ASP.NET MVC入门到精通——MVC过滤器
- ASP.NET WebAPI 07 路由