how to create crystal report using datagridview values without using database in C#? -
I am working in windows form application c # Instead of using database values, I want to create a crystal report with the datagrid view value. How can I do this, is it possible to do this? How to dynamically add value to crystal reports
You can create a dataset and dump it From the view, you can populate with values, after which you can bind the crystal report on the dataset.
Something on the lines of this:
DataSet ds = new DataSet (); DS = FetchDataFromGrid (); Crystal Report MyRport = New Crystal Report () myReport.SetDataSource (ds); CrystalReportViewer1.ReportSource = myReport
To retrieve the rows from a DataGridView, you'll need something like this:
DataSet ds = new DataSet ( ); Datatable dt = new datatable (); Forex Currency (DataGridViewRow Item in this.dataGridView1.Rows) {DataRow dr = dt.NewRow (); If (item data bound itam! = Null) {dr = (detoraw) item. Databbound item) .ro; Dt.ImportRow (Dr.); }} Dstables.ed (DT);
Comments
Post a Comment