I'm successfully passing a SQL Input Parameter when calling a Crystal Report,
so that the user doesn't get prompted. But I can't seem to find a way to pass
it the subreport.

Code for main report:
Dim ParameterFields As New ParameterFields
Dim ParameterField As New ParameterField
Dim spValue As New ParameterDiscreteValue

ParameterField.ParameterFieldName = "@ReportGUIDString"
spValue.Value = mSearchID
ParameterField.CurrentValues.Add(spValue)
ParameterFields.Add(ParameterField)

'Pass Input Param
Me.CrystalReportViewer1.ParameterFieldInfo = ParameterFields

'Link Report Instance with Viewer
Me.CrystalReportViewer1.ReportSource = ClientReportV1

The problem appears that you link the Parameter to the Viewer, opposed to
the report. How do I pass the parameter to the subreport?

I tried the following code but it didn't work:
Dim SummarySubReport As New ReportDocument
SummarySubReport = ClientReportV1.OpenSubreport("Summary Totals")
SummarySubReport.SetParameterValue("@ReportGUIDString", mSearchID)

Thanks.

RE: Passing a SQL Input Parameter to a Crystal Report Subreport by v-wdxu

v-wdxu
Mon Sep 26 00:47:47 CDT 2005

Hi,

Currently I am finding one support professional for you on this issue. When
any update, we will reply here at the first time.

Best Regards,
Wei-Dong XU
Microsoft Product Support Services
This posting is provided "AS IS" with no warranties, and confers no rights.
It is my pleasure to be of assistance.


RE: Passing a SQL Input Parameter to a Crystal Report Subreport by v-phuang

v-phuang
Tue Sep 27 00:54:52 CDT 2005

Hi

For Crystal Report issue as a third party product, I think you may try to
contact Business Objects Customer Support site.
http://www.businessobjects.com/support/default.asp

Thanks for your understanding!

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.


Re: Passing a SQL Input Parameter to a Crystal Report Subreport by Ayaz

Ayaz
Wed Sep 28 04:26:15 CDT 2005

Hello,

This is my C# Code.Please convert this code into vb.net


protected CrystalDecisions.Web.CrystalReportViewer CRViewer;
private Tables crTables;
private CrystalDecisions.CrystalReports.Engine.Table crTable;
private TableLogOnInfo crTableLogOnInfo;
TestReport crReportDocument=new TestReport();
private ConnectionInfo crConnectionInfo = new ConnectionInfo();
string databaseServer, databaseName, databaseUser, UserPassword;



ReportDocument crSubreportDocument;
Sections crSections;
SubreportObject crSubreportObject;
ReportObjects crReportObjects;
Database crDatabase;
Tables crTables;

crConnectionInfo.ServerName = databaseServer;//"AYAZ";
crConnectionInfo.DatabaseName = databaseName;//"DB";
crConnectionInfo.UserID = databaseUser;//"sa";
crConnectionInfo.Password = UserPassword;//"sa";

crTables = crReportDocument.Database.Tables;
for (int i = 0; i < crTables.Count; i++)
{
crTable = crTables [i];
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
crTable.Location =
crTable.Location.Substring(crTable.Location.LastIndexOf (".") + 1) ;
}

crSections = crReportDocument.ReportDefinition.Sections;
foreach (Section crSection in crSections)
{
crReportObjects = crSection.ReportObjects;
foreach (ReportObject crReportObject in crReportObjects)
{
if (crReportObject.Kind == ReportObjectKind.SubreportObject)
{
crSubreportObject = (SubreportObject) crReportObject;
crSubreportDocument =
crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);
crDatabase = crSubreportDocument.Database;
crTables = crDatabase.Tables;

foreach (CrystalDecisions.CrystalReports.Engine.Table aTable in
crTables)
{
crTableLogOnInfo = aTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
aTable.ApplyLogOnInfo(crTableLogOnInfo);
}
}
}
}

crReportDocument.SetParameterValue(@ToYear,YearVariable,crSubreportDocum
ent)
CRViewer.ReportSource = crReportDocument;


Regards,

Ayaz Ahmed
Project Manager
Creative Chaos (Pvt.) Ltd.
"Managing Your Digital Risk"
http://www.csquareonline.com
Mobile +92 300 2280950
Office +92 21 455 2414
Email: ayaz@csquareonline.com
ayazzahmed@gmail.com

*** Sent via Developersdex http://www.developersdex.com ***