title: How to pass parameters to crystal report?
body: <p>crystal report has two parameters field, however, i used three method searched, all failed.
  Error is missing parameter values.</p>
  
  <p>sure parameter is passing by query string
  <a href="http://localhost:1604/Cheques/viewReport.aspx?type=TT&amp;ID=5&amp;tCOMDB=Project_TR_TP_COM_Test" rel="nofollow">http://localhost:1604/Cheques/viewReport.aspx?type=TT&amp;ID=5&amp;tCOMDB=Project_TR_TP_COM_Test</a>
  checked by Label</p>
  
  <p>However, do not know why Error is missing parameter values.</p>
  
  <p>Method 1</p>
  
  <pre><code>// First parameter
              ParameterFieldDefinitions crParameterFieldDefinitions;
              ParameterFieldDefinition crParameterFieldDefinition;
              ParameterValues crParameterValues = new ParameterValues();
              ParameterDiscreteValue crParameterDiscreteValue = new ParameterDiscreteValue();
  
              crParameterDiscreteValue.Value = Request.QueryString["ID"];
              crParameterFieldDefinitions = objRpt.DataDefinition.ParameterFields;
              crParameterFieldDefinition = crParameterFieldDefinitions["Cheque_IssueRecord_Secretary_Review_TT_ID"];
              crParameterValues = crParameterFieldDefinition.CurrentValues;
  
              crParameterValues.Clear();
              crParameterValues.Add(crParameterDiscreteValue);
              crParameterFieldDefinition.ApplyCurrentValues(crParameterValues);
              // Second parameter
              ParameterFieldDefinitions crParameterFieldDefinitions2;
              ParameterFieldDefinition crParameterFieldDefinition2;
              ParameterValues crParameterValues2 = new ParameterValues();
              ParameterDiscreteValue crParameterDiscreteValue2 = new ParameterDiscreteValue();
  
              crParameterDiscreteValue2.Value = Request.QueryString["tCOMDB"];
              crParameterFieldDefinitions2 = objRpt.DataDefinition.ParameterFields;
              crParameterFieldDefinition2 = crParameterFieldDefinitions2["tCOMDB"];
              crParameterValues2 = crParameterFieldDefinition2.CurrentValues;
  
              crParameterValues2.Clear();
              crParameterValues2.Add(crParameterDiscreteValue2);
              crParameterFieldDefinition2.ApplyCurrentValues(crParameterValues2);
  </code></pre>
  
  <p>Method 2</p>
  
  <pre><code>//objRpt.SetParameterValue("Cheque_IssueRecord_Secretary_Review_TT_ID", Request.QueryString["ID"]);
              //objRpt.SetParameterValue("tCOMDB", Request.QueryString["tCOMDB"]);
  </code></pre>
  
  <p>Method 3</p>
  
  <pre><code>var value = new ParameterDiscreteValue();
              value.Value = Request.QueryString["ID"];
              objRpt.ParameterFields["Cheque_IssueRecord_Secretary_Review_TT_ID"].CurrentValues.Add(value);
  
              var value2 = new ParameterDiscreteValue();
              value2.Value = Request.QueryString["tCOMDB"];
              objRpt.ParameterFields["tCOMDB"].CurrentValues.Add(value2); 
  </code></pre>
  
  <p>This crystal report database use stored procedure,
  parameter field is automatically added, after added i removed @ character
  do not know why parameter missing</p>