Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
| Search | Today's Posts | Mark Forums Read
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 14th, 2006, 10:14 PM
Registered User
 
Join Date: Feb 2006
Location: , , Hong Kong.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default passing parameters to subreport (C#)

I am passing parameters to both the main report and sub-report. I tried to pass the parameters to the main report like this,

ReportDocument oRpt = new ReportDocument();
ParameterFieldDefinition paramField;
ParameterDiscreteValue mainValue = new ParameterDiscreteValue();
ParameterValues currentValues;

oRpt.Load(Server.MapPath("./Statement_top.rpt"));
oRpt.SetDatabaseLogon(USERID, PWD, SERVER, DB);

paramField = oRpt.DataDefinition.ParameterFields["accountID"];
currentValues = paramField.CurrentValues;
mainValue.Value = accountID;
currentValues.Add(mainValue);
paramField.ApplyCurrentValues(currentValues);

paramField = oRpt.DataDefinition.ParameterFields["fromDate"];
mainValue = new ParameterDiscreteValue();
mainValue.Value = fromDate;
currentValues.Clear();
currentValues.Add(mainValue);
paramField.ApplyCurrentValues(currentValues);

paramField = oRpt.DataDefinition.ParameterFields["toDate"];
mainValue = new ParameterDiscreteValue();
mainValue.Value = toDate;
currentValues.Clear();
currentValues.Add(mainValue);
paramField.ApplyCurrentValues(currentValues);

and then, I tried this,

rOpt.OpenSubreport("Statement_details.rpt");
paramField = oRpt.DataDefinition.ParameterFields["accountID1", "Statement_details.rpt"];
currentValues = paramField.CurrentValues;
mainValue.Value = accountID;
currentValues.Add(mainValue);
paramField.ApplyCurrentValues(currentValues);

it, however, seems the programme tried to pass the parameter to the main report, but not subreport.. Am I do it a wrong way? How can I pass the parameters to subreport in this case?? Thanks mate..
 
Old June 11th, 2006, 02:29 AM
Registered User
 
Join Date: Dec 2003
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am also facing same problem.Any one can help me?

TIA

 
Old June 13th, 2006, 01:07 PM
Registered User
 
Join Date: Jun 2006
Location: Scranton, PA, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am also having this problem....but just with a report not a subreport.........
My original posting.......
I am trying to integrate a crystal report into a classic asp application using Visual Studio 2005. I am having trouble passing the active client variable to the report to be used as a parameter.
Can anyone help?

Rob




Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameter to subreport lathika Visual Studio 2005 0 January 11th, 2008 12:53 PM
Passing parameter values to subreport pvalade Crystal Reports 0 November 21st, 2006 12:30 PM
Passing parameters from main report to subreport Swati_Jain Crystal Reports 0 May 24th, 2006 09:04 AM
Subreport parameters always zero low_entropy Crystal Reports 0 August 6th, 2005 07:05 PM
Passing parameters to subreport KathyW Crystal Reports 0 January 24th, 2005 10:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.