all groups > sql server reporting services > april 2005 >
You're in the

sql server reporting services

group:

WinForms.ReportViewer.Drillthrough event - how to handle?


WinForms.ReportViewer.Drillthrough event - how to handle? pdxfilter-google NO[at]SPAM yahoo.com
4/26/2005 12:57:48 PM
sql server reporting services: We're trying to implement a simple "proof-of-concept" drillthrough
report where a list of master records can be drilled into supporting
detail. We have this set up and working through the designer and would
like to programatically implement the functionality using ReportViewer.

We are displaying the main report without issues and have trapped the
Drillthrough event as follows:

void Drillthrough(object sender, DrillthroughEventArgs e) {
// Load the drillthrough report from a stream
FileStream FS = File.Open("DetailReport.rdl", FileMode.Open);
e.Report.LoadReportDefinition(FS);
FS.Close();
// Get the master record the user drilled into
ReportParameterInfoCollection Params =
e.Report.GetParameters();
int Key = int.Parse(Params[0].Values[0]);
// This works - we get the identity key of the master record here
DataTable DT = new DataTable();
new SqlDataAdapter(
"SELECT DetailFields FROM Detail WHERE Master=" + Key.ToString(),
"ConnectString").Fill(DT);
// Works - we get correct data here
reportViewer1.LocalReport.DataSources.Add(
new ReportDataSource("DetailDatasetName", DT));
// Not sure we need to manually set this param?
e.Report.SetParameters(new ReportParameter[]
{new ReportParameter("MasterParam", Key.ToString(), false)});
}

Everything _seems_ in place, but when drilling in, we get the following
error:

"A parameter or data source credential is missing a value. Prompting
for this value has been disabled. Supply a value or enable prompting."

I've checked for obvious problems. Any ideas?
Re: WinForms.ReportViewer.Drillthrough event - how to handle? Rajeev Karunakaran
4/26/2005 3:10:59 PM
The most likely reason is that in this line you didn't type the dataset name
exactly:

[quoted text, click to view]

Open the destination report using Notepad and verify that the dataset name
is exactly as you entered.

You shouldn't have to set the parameter value manually because the main
report is already passing it to the drillthrough report.

--
Rajeev Karunakaran [MSFT]
Microsoft SQL Server Reporting Services

This posting is provided "AS IS" with no warranties, and confers no rights.

[quoted text, click to view]

Re: WinForms.ReportViewer.Drillthrough event - how to handle? pdxfilter-google NO[at]SPAM yahoo.com
4/27/2005 12:27:36 PM
Good thought, but I don't think this is it. As a test, I tried running
the detail report as my "main" report and setting the parameter
manually. This works, so I don't think it's a problem with the detail
report or its data source.

During the Drillthrough event, the detail report is loading properly
into the viewer. This is evidenced by the parameter being set
correctly.

As you indicated, manually setting the parameter in the detail report
is not necessary. I'm not doing this any more. I've also verified
that the DataTable we're setting in the Drillthrough event has rows and
is sending correct data.

For another test, I tried setting a "Jump To" to a different report,
one with no parameters. Used similar code as posted before. Couldn't
get this to work either (same error).

Any ideas on what could be going on? I think we're probably close on
this. Just to verify; in the following line:

reportViewer1.LocalReport.DataSources.Add(
new ReportDataSource("DetailDatasetName", DT));

We should be setting the Drillthrough data via
reportViewer1.LocalReport.DataSources, correct? This adds a second
entry to DataSources for the detail data (the first entry is still
there from the main report data). Also, the "DetailDatasetName" should
be the exact name used in the detail report, no prefixes or
qualification, correct?

Ideas? Thanks for your help!
Re: WinForms.ReportViewer.Drillthrough event - how to handle? [MSFT]
4/30/2005 9:55:01 PM


[quoted text, click to view]


This is incorrect. In the Drillthrough event handler, the
DrillthroughEventObject has a Report property. You should set the data on
that object, so something like e.Report.DataSources.Add(new
ReportDataSource("DetailDatasetName", DT));
AddThis Social Bookmark Button