Groups > Asp .Net > Data Access and ObjectDataSource Control > Re: Using Multiple Tables in RDLC




Using Multiple Tables in RDLC

Using Multiple Tables in RDLC
Wed, 2 Apr 2008 07:22:15 +0000
I need to use multiples tables in a RDLC report.

First table is AuditReport

And Second table is CostPerUser

But in Report Viewer we can only set dataSource Name to one table like
thisReportDataSource dataSource = newReportDataSource();

dataSource.Name = "DataSet10_AuditReport";

dataSource.Value = ds1.Tables[0]

 So how we can use other table......

Pls rply
Post Reply
Re: Using Multiple Tables in RDLC
Wed, 2 Apr 2008 11:14:18 +0000
Code for Using RDLC Main report: ReportDataSource dataSource =
newReportDataSource();dataSource.Name = "DataSet12_AuditReport";

dataSource.Value = ds1.Tables[0];string reportTitle = "AuditReport";

ReportViewer1.ServerReport.Refresh();

ReportViewer1.LocalReport.Refresh();

ReportViewer1.LocalReport.DataSources.Clear();

ReportViewer1.LocalReport.DataSources.Add(dataSource);ReportViewer1.LocalReport.
ReportPath = Server.MapPath("../Reports/Report.rdlc");

ReportViewer1.LocalReport.DisplayName = reportTitle;

ReportViewer1.LocalReport.Refresh();

this is working fine

but now i need to show to sud reports in this (Report.rdlc) with two different
data tables

I found some where that i need to use SubreportProcessing Event handler like
this:

ReportViewer12.LocalReport.SubreportProcessing +=
newSubreportProcessingEventHandler(ItemsSubreportProcessingEventHandler);publicv
oid ItemsSubreportProcessingEventHandler(object sender,
SubreportProcessingEventArgs e)

{

e.DataSources.Add(newReportDataSource("DataSet10_CostPerUser",
ds1.Tables[0]));

}

The first subreport is containing report "Report2.rdlc", so
ReportViewer1 need to set to "Report2.rdlc" or i don't knw what to
do.............

But as i need to show two subreports, so what should i do

Please rply
Post Reply
about | contact