前台代码
- <table width="100%" border="0" marginwidth="0" marginheight="0">
- <tr>
- <td>
- <rsweb:reportviewer id="RvData" runat="server" Visible="false" Width="100%" Height="500px">
- </rsweb:reportviewer>
- </td>
- </tr>
- </table>
后台代码
- DataSet ds=new DataSet();
- ds = LogicLayer.GetJjAccount(Department, Unit);
- RvData.Visible = true;
- RvData.LocalReport.ReportPath = "../AccountWeb/Reports/JJ_Report.rdl";
- ReportParameter unitCode = new ReportParameter("unitCode", Unit);
- ReportParameter routePoint = new ReportParameter("RoutePoint", departmentkey);
- RvData.LocalReport.SetParameters(new ReportParameter[] { unitCode, routePoint });
- ReportDataSource rds = new ReportDataSource("JJ_DataSet", ds.Tables[0]);
- RvData.LocalReport.DataSources.Clear();
- RvData.LocalReport.DataSources.Add(rds);
- RvData.LocalReport.Refresh();
用代码方式动态加载报表,参数可以是界面上的传递值。报表为reporting service 2005 报表