title: Crystal report With parameter passing & change database information dynamically
body: <p>Please help me out Crystal report With more than one parameters passing &amp; change database information dynamically. I had code which is as follows:</p>
  
  <pre><code>        ParameterFields paramFields = new ParameterFields();
          ReportDocument reportDocument = new ReportDocument();
          reportDocument.Load(Server.MapPath(ReportName + ".rpt"));
  
  
          ParameterDiscreteValue crParameterDiscreteValue= new ParameterDiscreteValue();
          ParameterFieldDefinitions crParameterFieldDefinitions ;
          ParameterFieldDefinition crParameterFieldLocation ;
          ParameterValues crParameterValues = new ParameterValues();
          crParameterFieldDefinitions= reportDocument.DataDefinition.ParameterFields;
  
          // 1stParameter Satrt
          crParameterFieldLocation= crParameterFieldDefinitions["@userid"];
          crParameterValues= crParameterFieldLocation.CurrentValues;
          crParameterDiscreteValue= new CrystalDecisions.Shared.ParameterDiscreteValue();
          crParameterDiscreteValue.Value=Convert.ToInt64(ViewState["userid"]);
          crParameterValues.Add(crParameterDiscreteValue);
          crParameterFieldLocation.ApplyCurrentValues(crParameterValues);
          //1st Parameter End
           // 2nd Parameter Satrt
          crParameterFieldLocation= crParameterFieldDefinitions["@Reportname"];
          crParameterValues= crParameterFieldLocation.CurrentValues;
          crParameterDiscreteValue= new CrystalDecisions.Shared.ParameterDiscreteValue();
          crParameterDiscreteValue.Value=ReportName;
          crParameterValues.Add(crParameterDiscreteValue);
          crParameterFieldLocation.ApplyCurrentValues(crParameterValues);
          //2nd Parameter End
           // 3rd Parameter Satrt
          crParameterFieldLocation= crParameterFieldDefinitions["@SessionId"];
          crParameterValues= crParameterFieldLocation.CurrentValues;
          crParameterDiscreteValue= new CrystalDecisions.Shared.ParameterDiscreteValue();
          crParameterDiscreteValue.Value=Session.SessionID.ToString();
          crParameterValues.Add(crParameterDiscreteValue);
          crParameterFieldLocation.ApplyCurrentValues(crParameterValues);
          //3rd Parameter End
  
          CrystalReportViewer1.ReportSource = reportDocument;
           CrystalReportViewer1.EnableDatabaseLogonPrompt = false;
           ConnectionInfo connectionInfo = new ConnectionInfo();
           connectionInfo.ServerName = "192.168.0.245";
           connectionInfo.DatabaseName = "Databasename";
           connectionInfo.UserID = "sa";
           connectionInfo.Password = "Password1";
          TableLogOnInfo tableLogOnInfo = new TableLogOnInfo();
          tableLogOnInfo.ConnectionInfo= connectionInfo;
  
          foreach (CrystalDecisions.CrystalReports.Engine.Table table in reportDocument.Database.Tables)
      {
          table.ApplyLogOnInfo(tableLogOnInfo);
      }
  </code></pre>
  
  <p>It is now saying "Failed to open a rowset.". When I run the store procedure manually with the exact parameter values it showing the results. So the store procedure is returning the values. Please help me out. During the design of the Crystal report the database server information is different with the passing one.</p>