Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more: , +
I am new in doing crystal report and I could not seem to find the correct code to set parameter after researching for a long time. None of the code seems to work. Hopefully someone could help me in this! It would be great if anyone could teach me how to do it from the start as I might have done some steps wrongly.

I am trying to create a page where there's one textbox and a button. The textbox is to enter the ID and button is to show report. The crystal report will show the details of the particular ID that is entered in the textbox.

Please help and thank you in advance!
Posted
Updated 4-Aug-13 20:25pm
v4

1 solution

Hi,

Please review the following:

C#
this.reportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
this.reportViewer.LocalReport.ReportPath = Server.MapPath("//Path to your report");
this.reportViewer.LocalReport.DataSources.Clear();
this.reportViewer.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("Data Set Name", DataSet Variable));

Microsoft.Reporting.WebForms.ReportParameter[] parameters = new Microsoft.Reporting.WebForms.ReportParameter[1];
parameters[0] = new Microsoft.Reporting.WebForms.ReportParameter("Param Name", Par. Value, true);
                
this.reportViewer.LocalReport.SetParameters(parameters);
this.reportViewer.LocalReport.Refresh();


Hope this helps.>!!

Nayan
 
Share this answer
 
Comments
Liyinnnnn 4-Aug-13 23:08pm    
Hi Nayan,

Thanks for helping but I don't think it works. There's some error for example the processing mode:

It says " 'CrystalDecisions.Web.CrystalReportViewer' does not contain a definition for 'ProcessingMode' and no extension method 'ProcessingMode' accepting a first argument of type 'CrystalDecisions.Web.CrystalReportViewer' could be found (are you missing a using directive or an assembly reference?)"

And may I know where am I suppose to place it in? Sorry I'm not very good in programming!

Thanks!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900