Click here to Skip to main content
15,909,332 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello
how do subreport in crystal report whit c#?
Posted

 
Share this answer
 
http://vb.net-informations.com/crystal-report/vb.net_crystal_report_subreport.htm[^]
the page cannot to displayed
please help with c#
 
Share this answer
 
Comments
aayu 20-Sep-10 5:28am    
Please if you want to add something then use the Add Comment don't use answer.
Hi friend.

i have some suggested solution for your problem.
Make two datasets, one for the main report and the other for the subreprot.
populate both.
and then do as follows.

MyMainReport report = new MyMainReport();
report.SetDataSource(firstDataSet);
report.OpenSubReport(nameOfTheSubReport).SetDataSo urce(secondDataSet);

I've not tried it yet, but hope it will work.
good luck.
 
Share this answer
 
Assume that GetMainResult() and GetChangeState() return typed DataSet containng two tables "MainTableRecord" and "MainTableSubReportRecord" through which you have drop the field in your Reports.And also you bind subreport with the field which is common among MainTableRecord and MainTableSubReportRecord.

SOLUTION:
By this solution you will have a basic idea how to work with subReports in Crystal Report using C#.

ReportDocument customerReport = new ReportDocument();
customerReport.Load("D:\\MYWEBSITE\REPORTS\MainRep ort.rpt);

DataSet2 dsResult = rptMgr.GetMainResult();
DataSet2 dsSubReportResult = rptMgr.GetChangeState();

customerReport.SetDataSource(dsResult.Tables["MainTableRecord"]);

customerReport.OpenSubreport("MainSubReport.rpt"). SetDataSource(dsSubReportResult.Tables["MainTableSubReportRecord"]); ;

CrystalReportViewer1.Visible = true;
CrystalReportViewer1.ReportSource = customerReport;
CrystalReportViewer1.DataBind();
 
Share this answer
 
c# subreports in details

http://csharp.net-informations.com/c...subreports.htm
 
Share this answer
 
See here[^].
 
Share this answer
 
c# subreports in details

http://csharp.net-informations.com/c...subreports.htm


http://www.c-sharpcorner.com/UploadFile/mahesh
[^]
 
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