adspace
How to prepare parametrized (with more than one parameters) crystal report.pls tell me the code procedure, if any body can?
Answer Posted / Sudeep Kumar
Creating a parametrized Crystal Report with multiple parameters in .NET involves defining and setting the parameters in your Crystal Report file, as well as handling those parameters within your application's code. Here is a simple example of using a Crystal Report with two parameters in C#:nn```csharpnReportDocument crystalReport = new ReportDocument();
crystalReport.Load(Path.GetFullPath(@"C:MyReportsMyReport.rpt"));
TextObject param1 = (TextObject)crystalReport.Database.CommandInfo.FindParameter("Param1");
param1.Value = TextObject.Parse(""" + yourVariable1 + """);
TextObject param2 = (TextObject)crystalReport.Database.CommandInfo.FindParameter("Param2");
param2.Value = TextObject.Parse(""" + yourVariable2 + """);
CrystalDecisions.Shared.TableLogOnInfo logonInfo;
for (int i = 0; i < crystalReport.Database.Tables.Count; i++)
{
logonInfo = crystalReport.Database.Tables[i].LogOnInfo;
logonInfo.ConnectionInfo = crystalReport.Database.DefaultLogonInfo;
crystalReport.Database.Tables[i].ApplyLogOnInfo(logonInfo);
}
CrystalReportViewer1.ReportSource = crystalReport;n```
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers