Click here to Skip to main content
15,888,984 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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();


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();
Posted
Updated 8-Feb-18 20:21pm
Comments
Grafid 29-Jan-18 4:07am    
Any Help please ?
Thank you

1 solution

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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900