在C#Windows中将Datagridview导出到Crystal Report [英] Export Datagridview to Crystal Report in C# Windows
本文介绍了在C#Windows中将Datagridview导出到Crystal Report的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我读到的关于在C#Windows中将Data DataGridview导出到Crystal Report的每个主体都运行正常,但所有这些都有相同形式的Crystal Reportview,并使用该代码将数据绑定到crystalreport
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add( proname, typeof ( string ));
dt.Columns.Add( price, typeof ( decimal ));
dt.Columns.Add( quantity, typeof ( decimal ));
dt.Columns.Add( total, typeof ( decimal ));
foreach (DataGridViewRow dgv in dataGridView1.Rows)
{
dt.Rows.Add(dgv.Cells [ 1 ]。值,dgv.Cells [ 4 ]。值,dgv.Cells [ 6 ]。值,dgv.Cells [ 7 ]。值);
}
ds.Tables.Add(dt);
ds.WriteXmlSchema( Print.xml);
此 .dataGridView1.DataSource = null ;
this .dataGridView1.Rows.Clear();
txtamountnumber.Text = ;
CrystalReportSells cr = new CrystalReportSells();
cr.SetDataSource(ds);
如何将数据绑定到水晶按钮中的另一种形式的报告查看器点击不是以相同的形式
解决方案
您好,
请参考以下链接。它可以帮助您。
http://www.c-sharpcorner.com/UploadFile /krishnajina/CrystalReportwithXml06042005015225AM/CrystalReportwithXml.aspx
http://aspdotnetcsharpsqlserver.blogspot.in/2013/04/how-to-use-crystal-report-using-aspnet.html
hi every body i read about Export Datagridview to Crystal Report in C# Windows it works fine but all of these have Crystal Reportviewer in the same form and bind data to crystalreport using that code
DataSet ds = new DataSet();
DataTable dt = new DataTable();
dt.Columns.Add("proname", typeof(string));
dt.Columns.Add("price", typeof(decimal));
dt.Columns.Add("quantity", typeof(decimal));
dt.Columns.Add("total", typeof(decimal));
foreach (DataGridViewRow dgv in dataGridView1.Rows)
{
dt.Rows.Add(dgv.Cells[1].Value, dgv.Cells[4].Value, dgv.Cells[6].Value, dgv.Cells[7].Value);
}
ds.Tables.Add(dt);
ds.WriteXmlSchema("Print.xml");
this.dataGridView1.DataSource = null;
this.dataGridView1.Rows.Clear();
txtamountnumber.Text = "";
CrystalReportSells cr = new CrystalReportSells();
cr.SetDataSource(ds);
how can i bind the data to crystal report viewer in another form in button click not in the same form
解决方案
Hi,
please refer the below link.It may help you.
http://www.c-sharpcorner.com/UploadFile/krishnajina/CrystalReportwithXml06042005015225AM/CrystalReportwithXml.aspx
http://aspdotnetcsharpsqlserver.blogspot.in/2013/04/how-to-use-crystal-report-using-aspnet.html
这篇关于在C#Windows中将Datagridview导出到Crystal Report的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文