Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# SQL Reports
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();
cr.SetDataSource(ds);         
crystalReportViewer1.ReportSource = cr;
 

My SQL query is this
"select * from itpJobs J,itpJobCategory C, itpJobSubCategory S 
where 
J.jobCategory = C.jobCatId and J.jobSubCategory = S.jobSubCatid 
and C.jobCatId=" + jc + "and S.jobSubCatid=" + jsc + ""
Posted 8-Aug-12 7:52am
Edited 8-Aug-12 7:57am
v2
Comments
Kschuler at 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 at 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
good
Please Sign up or sign in to vote.

Solution 1

Please, read these articles:
SELECT[^]
FROM[^]
 
On the first look, your query should looks like:
"SELECT *
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 + ""
  Permalink  
Comments
Thilina C at 8-Aug-12 22:07pm
   
ok but still the problem is there. :(
losmac at 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
0 OriginalGriff 330
1 Sergey Alexandrovich Kryukov 295
2 ClimerChinna 207
3 Magic Wonder 205
4 Gihan Liyanage 192
0 Sergey Alexandrovich Kryukov 8,188
1 OriginalGriff 6,991
2 CPallini 2,598
3 Richard MacCutchan 1,925
4 Abhinav S 1,736


Advertise | Privacy | Mobile
Web03 | 2.8.140826.1 | Last Updated 8 Aug 2012
Copyright © CodeProject, 1999-2014
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