Last post Mar 06, 2012 03:11 PM by Inayat Rasool
Mar 06, 2012 10:50 AM|itman1981|LINK
I have build datatable base on the query. I want to show that on report.
I want to know when I want to show datatable data on gridview I do as follows..
grdview.datasource = dt;
CAN I DO THIS IN CRYSTAL REPORT WITH OUT DESIGN REPORT.I mean drag fields in crystal report...
string sql = "select * from product";
using (MySqlConnection conn
using (MySqlCommand cmnd
// report with no field in it
Mar 06, 2012 11:45 AM|Inayat Rasool|LINK
No, you need to desgin the report first using the fields that you have in the database or DATASET/DATATABLE.
Crystal report is not like GRid that it automatically populate your data without any design.
Open crystal and create a connection to datatable and it will show you all the fields and you need to then drag and drop the fields in the way you want the report to show up.
Mar 06, 2012 02:08 PM|itman1981|LINK
Thanks for response. But what if I am creating datatable at codebedind .like my datalayer funcation return me datatable so how can i create a connection to datatable at crystal report.
Mar 06, 2012 02:41 PM|Inayat Rasool|LINK
Crystal reports accepts either database fields or dataset fields as way to understand/populate the fields to design.
If I were you,
I would add a dataset in the project and and drag all the tables I am getting data from and design the report.
When coding behind, Crystal reports need that dataset or just datatable with all data in it
adapter.Fill(Ds, "my_dt");//Like this MY_DT IS DATATABLE
Practice some examples
Mar 06, 2012 02:55 PM|itman1981|LINK
thanks for reply... so you are saying that create XSD file, drag datatable on to it and and design report using datatable....
but boos how can i fill "my_dt." with custom query
Mar 06, 2012 03:11 PM|Inayat Rasool|LINK
After crystal design is done. You are now at start of pulling data out of database using code.
CODE BEHIND for datatable/dataset would be the regular process of creating connection,Query, pulling data out and then giving it to crystal reports.
Did you look at the sample ?