如何使用存储过程在我们的c#水晶报告代码中调用子报告 [英] How to subreports call in our c# code of crystal reports using stored proc

查看:57
本文介绍了如何使用存储过程在我们的c#水晶报告代码中调用子报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好我有使用存储过程调用水晶报告的想法

现在我想调用子报告如何执行此任务?



我创建了子报告并链接到mainreport。

使用数据绑定源连接到数据库。

那么如何在代码中调用子报告



我的子报告名称是SubReportMurchantAct.rpt

任何正文修改我的代码或举例...........

给我给一些示例代码调用subreport.plz ...



那么如何在代码中调用子报表

任何正文修改我的代码或给出示例...........



我的代码是打电话给主要水晶报告





 IDBManager dbManager =  new  DBManager(DataProvider.SqlServer); 
dbManager.ConnectionString = ConfigurationSettings.AppSettings [ SQLCN]。ToString();
dbManager.Open();
dbManager.CreateParameters( 1 );
dbManager.AddParameters( 0 @ Trandate,dateTimePicker1.Value.Date);
ds = dbManager.ExecuteDataSet(CommandType.StoredProcedure, sp_MerchantActivityByDateRangeRpt);
MerchantActivityCrpt obj = new MerchantActivityCrpt();
obj.SetDataSource(ds.Tables [ 0 ]);
crystalReportViewer1.ReportSource = obj;

解决方案

看看请





 MerchantActivityCrpt obj =  new  MerchantActivityCrpt(); 
obj.SetDataSource(ds.Tables [ 0 ]); obj.OpenSubreport( SubReportMurchantAct.rpt)。SetDataSource(DTSubreport);
crystalReportViewer1.ReportSource = obj;







DTSubreport是Sub报告的数据源。在我的情况下,这是一个Datable


我有相同的场景,但我的主报告没有表格。我的意思是我的主要报告是空白报告。你可以配置你的代码让我的子报告显示在主空白报告中吗?



我有这个帖子让你理解我的问题:



http://stackoverflow.com/questions/23237494/how-to-select-rows-from-two-time-ranges-to-crystal-report/23261027#23261027

Hello i have an idea of call crystal report using stored proc
now i want to call subreport how to do this task?

iam created subreport and link to mainreport.
iam using datadinding source for connect to database.
So how to call subreport in code

my subreport name is SubReportMurchantAct.rpt
any body modify my code or give example...........
Give me some example code to call subreport.plz...

So how to call subreport in code
any body modify my code or give example...........

my code is to call main crystal report


IDBManager dbManager = new DBManager(DataProvider.SqlServer);
                dbManager.ConnectionString = ConfigurationSettings.AppSettings["SQLCN"].ToString();
                dbManager.Open();
                dbManager.CreateParameters(1);
                dbManager.AddParameters(0, "@Trandate", dateTimePicker1.Value.Date);             
                ds = dbManager.ExecuteDataSet(CommandType.StoredProcedure, "sp_MerchantActivityByDateRangeRpt");
                MerchantActivityCrpt obj = new MerchantActivityCrpt();
                obj.SetDataSource(ds.Tables[0]);
                crystalReportViewer1.ReportSource = obj;

解决方案

Have a look Please


MerchantActivityCrpt obj = new MerchantActivityCrpt();
obj.SetDataSource(ds.Tables[0]);              obj.OpenSubreport("SubReportMurchantAct.rpt").SetDataSource(DTSubreport);                
crystalReportViewer1.ReportSource = obj;




DTSubreport is the Datasource of Sub report. In my case this is a Datable


I have the same scenario but my main report has no tables. I mean my main report is blank report. can u configure your code to have my subreport is displaying in the main blank report?

I have this thread to make you understand my issue:

http://stackoverflow.com/questions/23237494/how-to-select-rows-from-two-time-ranges-to-crystal-report/23261027#23261027


这篇关于如何使用存储过程在我们的c#水晶报告代码中调用子报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆