Click here to Skip to main content
13,589,969 members
Click here to Skip to main content
Add your own
alternative version


3 bookmarked
Posted 18 May 2010
Licenced CPOL

How to Create Subreport using Microsoft Reporting Service

, 18 May 2010
Rate this:
Please Sign up or sign in to vote.


I assumed that user have read this article


How to create and use sub reports using Microsoft Reports Here are the steps user can follow and create sub reports.

Step1:Create AddressInfo table and enter some data as show below.


Step2: Add New report to your project

Step3: Add a new DataTable to your dataSet Here is a sample of DataSet


Step4:Drag and drop a table on your report and

Step5:Drag and drop fields from your datasoure table to the report


Step6: User can delete the header and the footer since we are not using it this how the report will look


Step7: Add your Paramter to your report(Sub report)

Step8: Add you sub report to your main report


Step9: Link your report paramter from main to subreport using the property of the subreport.

Step 10: Here is the sample of the report.


The Code

ReportViewer1.LocalReport.SubreportProcessing +=
new SubreportProcessingEventHandler(MySubreportProcessingEventHandler);
MyDataClassesDataContext db = new MyDataClassesDataContext();
IQueryable<StudentInfo> data = from d in db.StudentInfos select d;
ReportDataSource rds = new ReportDataSource("MyDataSet_StudentInfoDataTable", data);

private void MySubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
MyDataClassesDataContext db = new MyDataClassesDataContext();
IQueryable<AddressInfo> mdata = from d in db.AddressInfos where d.StudentId.Equals(e.Parameters[0].Values[0].ToString()) select d;
e.DataSources.Add(new ReportDataSource("MyDataSet_AddressDataTable", mdata));


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


About the Author

Chief Technology Officer
United States United States
More than 15 years of experience in design, architecture and development of various commercial objects oriented application.Other Specialties

Data Migration:
• MS Access database to SQL 2005/2008
• MS Access database to Oracle
• MS Access database to My SQL
• FoxPro to SQL

Application Migration:
• Converted MS Access application to .net web application (
• Excel Application to .net 3.5 web application
• FoxPro application to .net 3.5
Reporting development and support
• MS access reports
• Crystal reports
• SQL Reports(SSRS)
• DevExpress reports
• Cognos reports
Application development and support
• .net Application web /Win forms
• SharePoint
• MS Access
• Website
• Ecommerce
• Web Services
3rd Party Control Support
• DevExpress
• .netForum
• Telerik
Version controls Support
• Team Foundation Server
• Source Safe

You may also be interested in...


Comments and Discussions

QuestionHow to use Sub Reports in Crystal Reports Pin
Member 1024702318-Feb-14 8:11
memberMember 1024702318-Feb-14 8:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02-2016 | 2.8.180618.1 | Last Updated 18 May 2010
Article Copyright 2010 by T.Ashraf
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid