How to get data of datagridview in Crystal Report in C#
14,006
Dear Saima Follow the given link. What you are missing is Table in design mode. Crystal report in design mode need to have a table that contains exactly the same field in your dataset Then you can use your code and it will work well
Hope this helps
Comments
-
Saima Maheen almost 2 years
I have a Window Form in C#. i want that when i click get report the exact data of datagridview also show in crystal report viewer.
DataTable dt = new DataTable(); DataSet ds = new DataSet(); dt = dataGridView1.DataSource as DataTable; ds.Tables.Add(dt); CrystalReport2 cos = new CrystalReport2(); cos.SetDataSource(ds); crystalReportViewer1.ReportSource = cos;
-
Noel Widmer over 6 yearsCan you elaborate on your answer? Posting a piece of code without any text is often not very helpful.