Print Page | Close Window

Subreport use in crystal report

Printed From: Crystal Reports Book
Category: General Information
Forum Name: Talk with the Author
Forum Discription: Ask Brian questions about his books and give him your comments. Like the book? Hate the book? Have suggestions? Let me know!
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=20752
Printed Date: 19 Apr 2024 at 3:41am


Topic: Subreport use in crystal report
Posted By: itsmekitanjal
Subject: Subreport use in crystal report
Date Posted: 20 May 2014 at 4:38am
Hi All,
 
I have below table in MSAccess
 
ID Name Category
1 John ASE
2 Kev ASE
3 Paul ASE
4 Lina SSE
5 Hendry SSE
 
I need to display result in two tables in one Crystal Report
1) one table for names with Category "ASE"
2) Second table for names with Category "SSE"
 
I can't display both categories details in one table
 
Please suggest how I can do this. I am using C# as language to generate this crystal report
 
Here is the script , I am using
Collapse | http://www.codeproject.com/Questions/772444/How-do-I-display-two-different-query-results-in-tw# - Copy Code
//CrystalReport1 is main where I want to show subreport
//CrystalReport4 is subreport

CrystalReport1 ObjRpt;
 
CrystalReport4 ObjRpt1;
 
ObjRpt = new CrystalReport1();
 
ObjRpt1 = new CrystalReport4();
 
String StrQuery;
 
StrQuery="SELECT Id,Name,MemberRank FROM Members WHERE Cat=1";
 
OleDbDataAdapter adp = new OleDbDataAdapter(StrQuery.ToString(), ControlRules.ClsConnect.Conn);
 
                DataSet ds = new DataSet();
 
                int ctr = adp.Fill(ds);
 
                DataSet1 Ds = new DataSet1();
 
                adp.Fill(Ds, "Customer");
 
StrQuery="SELECT Id,Name,SubRank,Ratiopergrop,NHPL,((KLP_Num * 120) - 25) as "RHN_Number" FROM Members WHERE Cat=2";
 
               OleDbDataAdapter adp1 = new OleDbDataAdapter(result1.ToString(), ControlRules.ClsConnect.Conn);
 
                DataSet ds1 = new DataSet();
 
                int ctr1 = adp1.Fill(ds1);
 
                ds1.Tables[0].Rows.Add(0, "", 0, 0, 0, 0);
 
                DataSet6 Ds1 = new DataSet6();
 
                adp1.Fill(Ds1, "Customer1");
 
                ObjRpt1.SetDataSource(Ds1);
 
                ObjRpt.SetDataSource(Ds);
 
                ReportDocument crystalReport = new ReportDocument();
 
                ReportDocument crystalReport1 = new ReportDocument();
 
                crystalReport=ObjRpt;
 
                crystalReport1 = ObjRpt1;
 
crystalReportViewer1.ReportSource = ObjRpt;



Replies:
Posted By: hilfy
Date Posted: 29 May 2014 at 3:02am
Which version of Crystal and Visual Studio are you using?

-Dell

-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics



Print Page | Close Window