急急!c# 水晶报表 dataset ,我报表设定 一字段分组,一字段求和 请问我dataset表的sql怎么写能传入报表 20
我select*from。。。或selecta,sum(b)from。。。groupbya传进去都不对。具体代码:SqlConnectionconn=newSqlConn...
我select * from 。。。或 select a,sum(b)from。。。group by a 传进去都不对。
具体代码:
SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=CinemaManageSystem;Integrated Security=True");
string sql = "select a.FNo,sum(c.money) from Film a,PlayList b,TicketingRecord c where a.FNo=b.FNo and b.LNo=c.LNo and FNo='123' group by a.FNo";
conn.Open();
SqlDataAdapter adapter = new SqlDataAdapter(sql,conn);
DataSet ds = new DataSet();
adapter.Fill(ds);
CrystalReport9 cry = new CrystalReport9();
cry.Refresh();
cry.SetDataSource(ds.Tables[0]);
this.crystalReportViewer1.ReportSource = null;
this.crystalReportViewer1.ReportSource = cry;
this.crystalReportViewer1.RefreshReport();
虽然没有报错,但出来的数据不是我sql查询的数据 实在搞不定啊~~
我试了一整天了还是不行 求高手帮忙!!!! 展开
具体代码:
SqlConnection conn = new SqlConnection("Data Source=.;Initial Catalog=CinemaManageSystem;Integrated Security=True");
string sql = "select a.FNo,sum(c.money) from Film a,PlayList b,TicketingRecord c where a.FNo=b.FNo and b.LNo=c.LNo and FNo='123' group by a.FNo";
conn.Open();
SqlDataAdapter adapter = new SqlDataAdapter(sql,conn);
DataSet ds = new DataSet();
adapter.Fill(ds);
CrystalReport9 cry = new CrystalReport9();
cry.Refresh();
cry.SetDataSource(ds.Tables[0]);
this.crystalReportViewer1.ReportSource = null;
this.crystalReportViewer1.ReportSource = cry;
this.crystalReportViewer1.RefreshReport();
虽然没有报错,但出来的数据不是我sql查询的数据 实在搞不定啊~~
我试了一整天了还是不行 求高手帮忙!!!! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询