Click here to Skip to main content
13,249,504 members (56,518 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I need to generate a report dynamically by using C#. Currently Im getting the values to a dataSet. Now I need to set that DataSet as the data source to my report. How can I do this.

Im using crystal reports at the moment... But Its not working
DataSet ds = dba.genarateReport2(cmbJobCat.SelectedValue.ToString(),cmbSubCat.SelectedValue.ToString());
CrystalReport1 cr = new CrystalReport1();
crystalReportViewer1.ReportSource = cr;

My SQL query is this
"select * from itpJobs J,itpJobCategory C, itpJobSubCategory S 
J.jobCategory = C.jobCatId and J.jobSubCategory = S.jobSubCatid 
and C.jobCatId=" + jc + "and S.jobSubCatid=" + jsc + ""
Posted 8-Aug-12 8:52am
Updated 8-Aug-12 8:57am
Kschuler 8-Aug-12 14:03pm
What do you mean "it's not working"? Is it causing an error? If so, what error are you getting? Or is it just not showing anything in the report?
Thilina C 8-Aug-12 14:06pm
Yes, It's not showing any thing in the report. When I manually set the database fields , It's displaying some values. But not according to my sql query

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Please, read these articles:

On the first look, your query should looks like:
FROM itpJobs AS J LEFT JOIN itpJobCategory AS C ON J.jobCategory = C.jobCatId LEFT JOIN itpJobSubCategory AS S ON J.jobSubCategory = S.jobSubCatid 
WHERE C.jobCatId=" + jc + " AND S.jobSubCatid=" + jsc + ""
Thilina C 8-Aug-12 22:07pm
ok but still the problem is there. :(
losmac 9-Aug-12 16:30pm
What kind of problem? Show me a realationships between tables, example data.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.171114.1 | Last Updated 8 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100