Question : Passing Parameters to Crystal Report Viewer - ASP.Net / C#.Net



I have developed the crystal report which is there in my Application Root Path.

I need to display the report, Based on selecting a Value from List Box.
ListBox - Value - Memberid is passed as Input for Stored Procedures which is then Populated to Crystal Report.


In this, I dont know - How to pass parameter & set the StoredProcedure.

If i am executing the Report.rpt directly from Crystal Report 2008 Editor it works fine by entering the Parameter Id.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
BusinessLogic.BLReport objBL = new BLReport();
            DataSet objDs = new DataSet();
            int iMemberId = 0;
 
            iMemberId = Convert.ToInt32(lstMember.SelectedValue);
            objDs = objBL.GenerateReport(iMemberId);
 
            string strReportPath = string.Empty;
            strReportPath = "C:\\MemberInsurance\\Report\\Report1.rpt";
 
            CrystalDecisions.CrystalReports.Engine.ReportDocument rptDocument = new ReportDocument();
            rptDocument.Load(strReportPath);
 
            rptDocument.SetDataSource(objDs.Tables[0]);
            rptViewer.ReportSource = rptDocument;

Answer : Passing Parameters to Crystal Report Viewer - ASP.Net / C#.Net

Random Solutions  
 
programming4us programming4us