具有SQL查询的动态报告 [英] Dynamic report with an SQL query
本文介绍了具有SQL查询的动态报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用C#动态生成报告.目前,我正在将值添加到数据集.现在,我需要将该DataSet设置为报表的数据源.我怎样才能做到这一点.
我目前正在使用水晶报表...但是它不起作用
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;
我的SQL查询是这个
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 + ""
推荐答案
请阅读以下文章:
SELECT [ FROM [
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 + ""
这篇关于具有SQL查询的动态报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文