private void ShowReport() { try { ReportViewer1.LocalReport.DataSources.Clear(); DSGPF ds = new DSGPF(); string reportPath = Server.MapPath("GPFAllEmployoeesYearlyRpt.rdlc"); DSGPFTableAdapters.usp_GPFPerYearRptTableAdapter da1 = new DSGPFTableAdapters.usp_GPFPerYearRptTableAdapter(); da1.Fill(ds.usp_GPFPerYearRpt, Convert.ToInt32(ddlDept.SelectedValue), Convert.ToInt32(ddlDesignation.SelectedValue), Convert.ToString(ddlYearFrom.SelectedValue), Convert.ToString(txtYearTo.Text)); ReportViewer1.LocalReport.EnableExternalImages = true; ReportViewer1.LocalReport.ReportPath = reportPath; ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", ds.Tables["usp_GPFPerYearRpt"])); ReportViewer1.LocalReport.Refresh(); } catch (Exception) { } }
private void ShowReport() { try { ReportViewer1.LocalReport.DataSources.Clear(); DSHR ds = new DSHR(); DSGPF ds2 = new DSGPF(); string reportPath = Server.MapPath("GPFIndividualEmployeeDetailRpt.rdlc"); DSHRTableAdapters.usp_EmployeeBasicInfoByIDTableAdapter da1 = new DSHRTableAdapters.usp_EmployeeBasicInfoByIDTableAdapter(); DSGPFTableAdapters.usp_GPFIndividualDetailRptTableAdapter da2 = new DSGPFTableAdapters.usp_GPFIndividualDetailRptTableAdapter(); da1.Fill(ds.usp_EmployeeBasicInfoByID, Convert.ToInt32(EmpID)); da2.Fill(ds2.usp_GPFIndividualDetailRpt, Convert.ToInt32(EmpID), Convert.ToInt32(ddlYearFrom.SelectedValue), Convert.ToInt32(txtYearTo.Text)); DataTable dt = ds.Tables["usp_EmployeeBasicInfoByID"]; string logoID = Convert.ToString(dt.Rows[0]["User_ID"]); string PhotoExtension = Convert.ToString(dt.Rows[0]["PhotoExtension"]); ReportParameter paramLogo = new ReportParameter(); paramLogo.Name = "EmpPicPath"; string path; path = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase); path = path.Substring(6, path.Length - 9); paramLogo.Values.Add("file:///" + path + @"Uploads\EmployeePhoto\" + logoID + Convert.ToString(PhotoExtension)); ReportViewer1.LocalReport.EnableExternalImages = true; ReportViewer1.LocalReport.ReportPath = reportPath; ReportViewer1.LocalReport.SetParameters(paramLogo); ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("DataSet1", ds.Tables["usp_EmployeeBasicInfoByID"])); ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("DataSet2", ds2.Tables["usp_GPFIndividualDetailRpt"])); ReportViewer1.LocalReport.Refresh(); } catch (Exception) { } }