Click here to Skip to main content
14,486,704 members
Rate this:
Please Sign up or sign in to vote.
See more:
Dear sir/mam

I am Shailendra singh. I am .net Developer .I want to Show CystalReport in asp.net by parameter data fetch more than one table.How can possible step by step process in asp.net(C#).Please help me It is very argent work .
Thanks for Advance


shailendra singh
Posted
Updated 24-Mar-20 6:06am
Rate this:
Please Sign up or sign in to vote.

Solution 1

   
v2
Rate this:
Please Sign up or sign in to vote.

Solution 2

Link mentioend in Solution1 is broken now !!, can u please update link ?

This solution is worked for me.

// Declare Variable for Report Document

static ReportDocument rpt = new ReportDocument();

// Load Report Document with proper report file location
ReportFileName = Server.MapPath(@"RPTGenerateTariffWiseSalesReport.rpt");
rpt.Load(ReportFileName, OpenReportMethod.OpenReportByTempCopy);

//Initialise & Assign Parameter Values
DateTime TodaysDate;
string CompanyCode;

CompanyCode = SearchParams["CompanyCode"].ToString();
TodaysDate = DateTime.Parse(SearchParams["TodaysDate"].ToString());

//Pass Parameter Values in Report using setParameterValues
rpt.SetParameterValue("@CompanyCode", CompanyCode);
rpt.SetParameterValue("@TodaysDate", TodaysDate);

// Assign new ReportDocument to ReportViewer as Report Source
TariffWiseSalesReportViewer.ReportSource = rpt;

//Refresh Report
TariffWiseSalesReportViewer.RefreshReport();
   
v3
Rate this:
Please Sign up or sign in to vote.

Solution 3

Here is the code for passing parameter to crystal reports

ParameterFieldDefinitions crParameterFieldDefinitions ;
ParameterFieldDefinition crParameterFieldDefinition ;
ParameterValues crParameterValues = new ParameterValues();
ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();

crParameterDiscreteValue.Value = Convert.ToInt32(textBox1.Text);
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields;
crParameterFieldDefinition = crParameterFieldDefinitions["Price"];
crParameterValues = crParameterFieldDefinition.CurrentValues;

full source code...Passing parameter to Crystal Reports

Johnson
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100