private void Form1_Load(object sender, EventArgs e) { frmSearch frm = new frmSearch(); try { ReportDataSource rpt; this.reportViewer1.LocalReport.ReportPath = "Report2.rdlc"; connect = new SqlConnection(conStr.connectString); connect.Open(); string sel = "select * from tblIssue_Books where member_id='" + id + "'"; cmd = new SqlCommand(sel, connect); da = new SqlDataAdapter(cmd); IssuedBooksDataSet ds = new IssuedBooksDataSet(); cmd.Parameters.Add(new SqlParameter("@VALUE", SqlDbType.VarChar)).Value = frm.txtMemid.Text; da.Fill(ds.tblIssue_Books); rpt = new ReportDataSource("IssuedBooksDataSet", ds.Tables["tblIssue_Books"]); this.reportViewer1.LocalReport.DataSources.Add(rpt); this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); this.reportViewer1.ZoomMode = ZoomMode.Percent; this.reportViewer1.ZoomPercent = 50; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.reportViewer1.RefreshReport(); }
private void frmIssued_Load(object sender, EventArgs e) { ReportDataSource rpt; try { this.reportViewer1.LocalReport.ReportPath = "Report1.rdlc"; tblIssue_BooksTableAdapter da = new tblIssue_BooksTableAdapter(); IssuedBooksDataSet ds = new IssuedBooksDataSet(); da.Fill(ds.tblIssue_Books); rpt = new ReportDataSource("IssuedBooksDataSet", ds.Tables["tblIssue_Books"]); this.reportViewer1.LocalReport.DataSources.Add(rpt); this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout); this.reportViewer1.ZoomMode = ZoomMode.Percent; this.reportViewer1.ZoomPercent = 50; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.reportViewer1.RefreshReport(); }