why crystal report always display first order opened in developer side?

Viewed 20

I am using VS 2019 and crystal reports , I passing the order id and test id to the report when click download result button This is the code :

<li><a style="margin-left:700px;margin-bottom:15px" href="/RPT/WebForm1.aspx/?order_number=@Model.labClinicsViewResult.First().order_number&deptid=0&testid=@Model.labClinicsViewResult.First().Test_Id&Culture=@Model.labClinicsViewResult.First().Culture" class="btn btn-danger">Download Result</a></li>

Then in webform1.aspx page I created the crystal report viewer and display the data passed from the other page this is the code :

<form id="form1" runat="server">
    <div>
    <asp:TextBox ID="TXTORDERID" runat="server"></asp:TextBox>
        <asp:TextBox ID="TXTDEPTID" runat="server"></asp:TextBox>
        <asp:TextBox ID="TXTTESTID" runat="server"></asp:TextBox>
        <asp:TextBox ID="TXTCULTURE" runat="server"></asp:TextBox>
        <asp:TextBox ID="TXTPOSITIVE" runat="server"></asp:TextBox>
      
        <br />
    
        <br />
        
        
    </div>
        <br />

        <div id="dvReport">
      <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
        </div>

    </form>

Also this is the code to add the parameter and run the report :

if (Convert.ToInt32(TXTDEPTID.Text) == 0)
                    {

                        parameterField1.Name = "@ORDER_ID";
                        parameterDiscreteValue1.Value = (object)this.TXTORDERID.Text.ToString();
                        parameterField1.CurrentValues.Add((ParameterValue)parameterDiscreteValue1);
                        parameterFields.Add(parameterField1);

                     
                        this.CrystalReportViewer1.ParameterFieldInfo = parameterFields;
                        this.CrystalReportViewer1.ReuseParameterValuesOnRefresh = true;
                        this.CrystalReportViewer1.ToolPanelView = ToolPanelViewType.None;
                        reportDocument.Load(this.Server.MapPath("~/RPT/RPTCREDITRESULTS.rpt"));
                        this.CrystalReportViewer1.ReportSource = (object)reportDocument;
                        reportDocument.SetDatabaseLogon("sa", "123456");

                        ConnectionInfo connectionInfo = new ConnectionInfo();
                        connectionInfo.ServerName = "server";
                        connectionInfo.DatabaseName = "DB";
                        connectionInfo.Password = "123456";
                        connectionInfo.UserID = "sa";
                        connectionInfo.Type = ConnectionInfoType.SQL;
                        connectionInfo.IntegratedSecurity = false;
                        for (int index = 0; index < this.CrystalReportViewer1.LogOnInfo.Count; ++index)
                            this.CrystalReportViewer1.LogOnInfo[index].ConnectionInfo = connectionInfo;

         

       }

when I tested the report for example I printed order_id = 2100022182 The issue when I run the project and click download result its always show the result for order id = 2100022182 I opened in testing and not refreshing and taking the order id which I select next time

I need your help please .

Important point : I'm using before VS 2015 and its working correct before with VS 2015 and now I shifted to use VS 2019 is there any settings or updates I need to do for the report or the code ?

enter image description here

This is first image order id passed to the textbox in second image but the printed order different

enter image description here

0 Answers
Related