在水晶报告C#中将参数发送到子报告 [英] Sending paramaters to subreport in crystal report C#

查看:53
本文介绍了在水晶报告C#中将参数发送到子报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好

我正在尝试将参数发送到主报表中的子报表但数据没有显示!!

数据显示正确当我将参数发送到主报告时。但不是分报告。

我有什么? :

- 一个特定汽车的get_all_expenses程序和费用的性质。

@Nat(费用的性质)

@Immatr(汽车注册号)。



我发送那些主要报告的参数使用:

Hello there
I'm trying to send parameters to a subreport in the main report but the data doesn't show up !!
The data shows up correctly when I send the parameters to the main report. But not to the sub-report.
What I have ? :
- a Procedure that get_all_expenses for one particular car AND the nature of the expenses.
@Nat (nature of the expense)
@Immatr (Cars registration number).

I send those param to the main report using this :

RPT.rptDepenses myReport = new RPT.rptDepenses();
myReport.SetParameterValue("@Nat", "Nature 1");
myReport.SetParameterValue("@Immatr", txt_Immatricule.Text);
RPT.FRM_PRINT myForm = new RPT.FRM_PRINT();
myForm.crystalReportViewer1.ReportSource = myReport;
myForm.ShowDialog();





我在主报告中需要2个子报告,所以我可以添加自然2数据。 />


对此有任何帮助,我很感激。

我在发布自己的问题之前一直在寻找答案,希望有人可以拥有想法。

非常感谢你。



我尝试了什么:



我试图用param 0添加子报表字符串但是没有用。



I need 2 sub-report in the main report so I can add the "Nature 2" data.

Any help with this please I appreciate it.
I'v been looking around for an answer before posting my own question hoping someone could have an idea.
Thank you so much.

What I have tried:

I tried to add the subreport string with param 0 but didn't work.

            RPT.rptDepenses myReport = new RPT.rptDepenses();
myReport.SetParameterValue("@Nat", "Nature 1", myReport.Subreports[0].Name.ToString());
myReport.SetParameterValue("@Immatr", txt_Immatricule.Text, myReport.Subreports[0].Name.ToString());
RPT.FRM_PRINT myForm = new RPT.FRM_PRINT();
myForm.crystalReportViewer1.ReportSource = myReport;
myForm.ShowDialog();

推荐答案

如果你有更多的子报告,那么尝试更改子报告[]如果你的程序是正确的,并且如果它成功获取数据,那么错误就是子报告[]。

为子报告创建数据集。后面的代码发送数据



子报告数据集=您的数据

将此子报告添加到主报告



通过右键单击您将获取添加子报表的选项.so添加作为子报表的现有报表。

将数据分配给这两个报表的数据集
if you have more number of subreports then try to change the subreport[] with different numbers if your procedure is correct and if it is successfull in fetching the data then the fault is with subreport[].
create dataset for sub report .and code behind send data

subreport dataset=your data
add this subreport to main report

by right clicking you will get an option to add subreport .so add the existing report that is your subreport.
assign data to datasets of those two reports


这篇关于在水晶报告C#中将参数发送到子报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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