1.新建项目
2.添加引用
3.config中添加如下
<system.web>
<httpHandlers>
<add path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport" />
</httpHandlers>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="FastReportHandler" path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport" />
</handlers>
</system.webServer>
4.界面(有些初次使用的同志可能需要在工具箱添加FastReport控件)
5.后台代码
dt = new DataTable();
tjrq = tjrq.Substring(0, 10);
////// 查的存档信息
dt = db.MysqlDataTable("SQL语句");
FastReport.Web.WebReport webReport = new FastReport.Web.WebReport();
string Path = Server.MapPath("~/report/rp_duib1__bak.frx");//模板路径
dt.TableName = "health_data";//表名
DataSet dsa = new DataSet();
dsa.Tables.Add(dt.Copy());
WebReport2.ReportFile = Path;
WebReport2.RegisterData(dsa);
原文地址:https://www.cnblogs.com/zylbky/p/12175403.html