水晶报表的问题!求助

超凡 2010-12-09 02:24:10

OleDbConnection co = new OleDbConnection("Provider=sqloledb;Data Source=" + server + ";Initial Catalog=" + database + ";uid="+Uid+";pwd="+Pwd+";");
adp = new OleDbDataAdapter("SELECT '1.结账汇总' AS flag,C_SSNo,C_SSName, N_DCFlag,( SELECT SUM(b.N_Money)FROM hi_account b WHERE (b.C_SSNo = a.C_SSNo)"+
" AND (b.C_State = 'C')"+
" AND (b.D_DTime > '2010-08-03')"+
" AND (b.D_DTime <= '2010-08-06')"+
" AND C_DGrade='中班'"+
" AND C_DOper='9435') AS Expr1 FROM HI_StatSub a WHERE (N_DCFLag <> 0) AND (C_IfDelete <> 'Y') "+
"union SELECT '2.收退定金(押金)合计' AS flag,C_SubNo, C_SubName, N_DCFlag,(SELECT SUM(b.N_Money) FROM hi_account b WHERE (b.C_DSNo = a.C_SubNo) AND (b.D_CTime > "+
"'2010-08-03') AND (b.D_CTime <='2010-08-06') AND C_CGrade='中班' AND C_DOper='9435') AS Expr1 FROM HI_Subject a WHERE (C_SSNo = 'AAA') or (C_SSNo = 'BBB') and (C_IfDelete<>'Y') "+
"union SELECT '2.收退定金(押金)合计' AS flag,C_SSNo, '退' + C_SSName, N_DCFlag,(SELECT SUM(0-b.N_Money) FROM hi_account b WHERE (b.C_sSNo = a.C_sSNo) AND (b.C_State = 'C') AND (b.D_DTime >"+
"'2010-08-03') AND (b.D_DTime <='2010-08-06') AND C_DGrade='中班' AND C_DOper='9435') AS Expr1 FROM HI_StatSub a where (C_SSNo = 'AAA') and (C_IfDelete<>'Y') ", co);

adp.Fill(dataset, "HI_Account");//请问我这里应该是填写datatable中的表名还是填写数据库中的,如果填写数据库中的那我这样不是行不通,请问有什么更好的办法吗?


AccountReport repors = new AccountReport();


repors.SetDataSource(dataset);
crystalReportViewer1.ReportSource = repors;
...全文
42 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
阿双2009 2010-12-09
[Quote=引用楼主 hncelfhv 的回复:]
adp.Fill(dataset, "HI_Account");//请问我这里应该是填写datatable中的表名还是填写数据库中的[/Quote]
datatable中的表名
回复
超凡 2010-12-09
在线求解!
回复
相关推荐
发帖
图表区
创建于2007-09-28

4808

社区成员

.NET技术 图表区
申请成为版主
帖子事件
创建了帖子
2010-12-09 02:24
社区公告
暂无公告