C# – Passing stored procedure Parameter to Crystal Report in ASP.Net

asp.netccrystal-reports

Visual Studio 2012 Ultimate edition
Sql Server: 2005
The problem is , when i pass a parameter value to crystal report , in first go it show me the exact result in browser but when i click on next page it shows null result.

following is a simple stored procedure

Create Procedure SP_SearchDDO @ddo varchar(10)
{
   As
   Begin
        Select * from PData where DDO = @ddo
   end
}

Here is the code

Protected void btn_search_Click(object sender, EventArgs e)
{
   ReportDocument rptDoc = new ReportDocument();
   string rptPath = Server.MapPath("ddoReprt.rpt");
   rptDoc.Load(rptPath);
   rptDoc.SetParameterValue("@ddo", "ABC");
   CrystalReportViewer1.ReportSource = rptDoc;
}

When i click on search button in browser it shows exact "ABC" required result, when i click on next page button (Crystal report viewer embedded button ), then "ABC" parameter result lost and show null result.
Plz tell me where i am doing wrong?

Best Answer

have u tried

ReuseParameterValuesOnRefresh="True" for the crystalreprotviewer ?

Related Topic