Visual Studio .NET - Loading Crytal report with Parameters and subreports in ASp.net

Asked By Ralph Acido on 01-Feb-07 10:22 PM
how to load Crytal report with Parameters and subreports in ASp.net  1.1?

hope these links helps! - sundar k replied to Ralph Acido on 01-Feb-07 10:59 PM

Pass Database Logon to Subreport in CR for .Net C# Webapp

This C# .NET sample application demonstrates how to log onto a data source for a main report and subreports.

http://diamond.businessobjects.com/node/303

http://diamond.businessobjects.com/system/files/csharp_web_subreport_logon.zip

Pass Data Range Parameter to a subreport in CR for .NET C# Web app

This C# .NET sample web application demonstrates how to pass a date range to a date Range Parameter in a subreports using the CrystalReportViewer.

http://diamond.businessobjects.com/node/302

http://diamond.businessobjects.com/system/files/csharp_web_subreport_daterangeparameter.zip


Working with ASP.NET and Crystal Reports 9 with or without RAS 9

http://www.codeproject.com/aspnet/crystalwithaspdotnet.asp

http://support.businessobjects.com/communityCS/FilesAndUpdates/vbnet_web_samples.exe.asp

Passing SQL logon information to a report and subreport in VB .NET

http://technicalsupport.businessobjects.com/KanisaSupportSite/search.do?cmd=displayKC&docType=kc&externalId=c2010275&sliceId=&dialogID=360384&stateId=1%200%20356275

Crystal Subreport with asp.net

http://www.experts-exchange.com/Databases/Crystal_Reports/Q_21798338.html


Sushila Patel replied to Ralph Acido on 01-Feb-07 11:08 PM

Check out the link http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=310

below is code from link

<extract>

 // Create parameter objects
  ParameterFields myParams = new ParameterFields();
  ParameterField myParam = new ParameterField();
  ParameterDiscreteValue myDiscreteValue = new ParameterDiscreteValue();

  // Set the ParameterFieldName to the name of the parameter
  // created in the Field Explorer
  myParam.ParameterFieldName = "Country";

  // Add first country
  myDiscreteValue.Value = "USA";
  myParam.CurrentValues.Add(myDiscreteValue);

  // Reuse myDiscreteValue, and assign second country
  myDiscreteValue = new ParameterDiscreteValue();
  myDiscreteValue.Value = "Netherlands";
  myParam.CurrentValues.Add(myDiscreteValue);

  // Add param object to params collection
  myParams.Add(myParam);

  // Assign the params collection to the report viewer
  myCrystalReportViewer.ParameterFieldInfo = myParams;

  // Assign the Report to the report viewer.
  // This method uses a strongly typed report,
  // but other methods are possible as well.
  myCrystalReportViewer.ReportSource = MyReportObject;

</extract>

Re :: Loading Crytal report with Parameters and subreports in ASp.net

Shailendrasinh Parmar replied to Ralph Acido on 21-Nov-08 06:45 AM

Hi

(1) Add the parameter that you require for the subreport to the main report. To do this open the Field Explorer window, right click Parameter Fields and select new. If you are using a stored procedure for the subreport use the same name for the parameter as you have used in the stored procedure e.g. @De_ID; Also ensure that the datatype for the parameter is compatible with the stored procedure e.g. Use number if the stored procedure parameter type is int.

(2) Once you have added your parameter right click the subreport and select Change Subreport Links... This will open the Subreport Links window. Scroll down the Available Fields Treeview in the top left of the window. Under Report fields locate the parameter you added in step one. Select the parameter and press the > button. Click the "Subreport parameter field to use:" dropdownlist and select your parameter from the list. Press the OK button. Now the subreport should use whatever value is in the parameter you added to the main report in step 1.

(3) You can populate the value of a reports parameter programatically by doing the following.


Dim pv As Integer = 1 'Parameter value
Dim pn As String = "@De_ID" 'Parameter name
reportDoc.SetParameterValue(pn, pv)

 Note you have to setup the Report Document object before you add parameters to it. See code above.

Good luck.

View Post for more details :: http://forums.asp.net/t/1212579.aspx

Hope this helps

Re :: Loading Crytal report with Parameters and subreports in ASp.net
Shailendrasinh Parmar replied to Ralph Acido on 21-Nov-08 06:46 AM

See this article for more details

http://www.codeproject.com/KB/recipes/CrystalReports_in_VBNET.aspx?fid=160171&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=51&select=1638081

Hope this helps.