title: How to send parameters to Subreport in Crystal Reports
body: <p>Using VS 2008.</p>
  
  <p>I have two stored procedures, one used to get data for the main report and other for Sub report and both the SP's use the same parameter QuoteID.</p>
  
  <p>I have send parameter to main report  using ReportDocument. But I am not aware how to send parameters to SubReport.</p>
  
  <p>I tried many diff ways using the reportdocument's setparameter method which also takes subreport name as argument.But it didn't.</p>
  
  <p>Below is the code I have used</p>
  
  <pre><code>    string Type = gvQuotationDetails.Rows[QuoteIndex].Cells["Type"].EditedFormattedValue.ToString();
  
      FilePath = ConfigurationManager.AppSettings["EMP_IMG_PATH"].ToString() + "\\" + ValQuoteID.ToString() + ".pdf";
  
      DeleteExistingFile(FilePath);
  
      try
      {
          AccountsPayableMaster objAPM = new AccountsPayableMaster();
          QuotationReport obj = new QuotationReport();
          objReportDocument.Load(Application.StartupPath + @"\rptQuotationReport.rpt");
          obj.crysQuotationReport.LogOnInfo = objAPM.ConnectionDetails("SD_SalesOrderReport;1");
          obj.crysQuotationReport.LogOnInfo = objAPM.ConnectionDetails("SD_GetBatchReportDetails;1");
          obj.crysQuotationReport.ReportSource = objReportDocument;
          objReportDocument.SetParameterValue("@QuoteID", ValQuoteID);
          objReportDocument.SetParameterValue("Type", Type);
          //objReportDocument.Subreports[Application.StartupPath + @"\BatchSubReport.rpt"].SetParameterValue("@QuoteID", ValQuoteID);
          //objReportDocument.Subreports["BatchReport.rpt"].SetParameterValue("@QuoteID", ValQuoteID);           
  
          string[] Print = objAPM.GetPrintDetails();
  
          SetPrintParameters(objReportDocument, Print);
  
          obj.Show();
  
          objReportDocument.ExportToDisk(ExportFormatType.PortableDocFormat, FilePath);
      }
  
      catch (Exception ex)
      {
          MessageBox.Show(ex.Message); 
      } 
  </code></pre>
  
  <p>Sending parameter to Subreport</p>
  
  <pre><code>//objReportDocument.Subreports[Application.StartupPath + @"\BatchSubReport.rpt"].SetParameterValue("@QuoteID", ValQuoteID);
  
  //objReportDocument.Subreports["BatchReport.rpt"].SetParameterValue("@QuoteID", ValQuoteID);              
  
  ////objReportDocument.SetParameterValue("@QuoteID", ValQuoteID,"BatchReport.rpt);
  </code></pre>
  
  <p>nothing worked.I have already wasted two days on this. <code>[SD_SalesOrderReport;1]</code> main SP and <code>[SD_GetBatchReportDetails;1]</code> subreport SP.</p>
  
  <p>It would be great if someone can provide a solution for this.If there are some changes to be made in designed please share images.Thank you.</p>