private void report_Click(object sender, EventArgs e)
 {
     try
     {
         reportViewer report           = new reportViewer();
         librarayManagementDataSet8 ds = new librarayManagementDataSet8();
         bookReport br = new bookReport();
         adapter1.Fill(ds.book_registration);
         br.SetDataSource(ds);
         report.crystalReportViewer1.ReportSource = br;
         report.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #2
0
        private void rp_Click(object sender, EventArgs e)
        {
            reportViewer        report = new reportViewer();
            memberReportDataSet ds     = new memberReportDataSet();
            memberDetailReport  br     = new memberDetailReport();
            DataTable           dt     = new DataTable();

            foreach (DataGridViewRow item in this.dataGridView1.Rows)
            {
                DataRow dr = dt.NewRow();

                if (item.DataBoundItem != null)
                {
                    dr = (DataRow)((DataRowView)item.DataBoundItem).Row;
                    ds.DataTable1.ImportRow(dr);
                }
            }

            ds.DataTable1.Rows.RemoveAt(dataGridView1.Rows.Count - 1); //removing the last row because it contain total fine which is causing problem
            br.SetDataSource(ds);
            report.crystalReportViewer1.ReportSource = br;
            report.Show();
        }