i have two datagridviews with different rows counts.i want to add them in to one crystal report.
this is my report
http://i.imgur.com/2ixrXBr.png
i want out put like this.
http://i.imgur.com/8e6T635.jpg[
^]
What I have tried:
private void button1_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("Total", typeof(string));
foreach (DataGridViewRow dgr in dataGridView1.Rows)
{
dt.Rows.Add(dgr.Cells[0].Value, dgr.Cells[1].Value);
}
ds.Tables.Add(dt);
ds.WriteXmlSchema("testdata.xml");
//-----------------------------------------------------------
DataSet ds1 = new DataSet();
DataTable dt1 = new DataTable();
dt1.Columns.Add("Name", typeof(string));
dt1.Columns.Add("Product", typeof(string));
dt1.Columns.Add("Qty", typeof(string));
foreach (DataGridViewRow dgr1 in dataGridView2.Rows)
{
dt1.Rows.Add(dgr1.Cells[0].Value, dgr1.Cells[1].Value ,dgr1.Cells[2].Value);
}
ds1.Tables.Add(dt1);
ds1.WriteXmlSchema("dxdx.xml");
//------------------------
ReportDocument report = new paysheet();
report.Database.Tables[0].SetDataSource(dt);
report.Database.Tables[1].SetDataSource(dt1);
crystalReportViewer1.ReportSource = report;
}