shiva shanth

shiva shanth

  • NA
  • 15
  • 1.3k

Sending Parameters to crystal reports

Apr 29 2013 2:57 AM
My Code Fallows  like this.

 ReportDocument cryRpt = new ReportDocument();
            ParameterField paramField = new ParameterField();
          
            ParameterDiscreteValue dis = new ParameterDiscreteValue();
            this.WindowState = FormWindowState.Maximized;
            conn.ConnectionString = connectionstring.get_string(connectionstring.GetsqlName());
            balreport bs = new balreport();
            BalDatasetTableAdapters.tbl_Balence_Sheet_1TableAdapter ta = new Reports.BalDatasetTableAdapters.tbl_Balence_Sheet_1TableAdapter();
            BalDataset.tbl_Balence_Sheet_1DataTable table = ta.GetData();
          //  bs.SetParameterValue("@Socname", socname);
           // bs.ParameterFields.Add(paramField);
           
            paramField.ParameterFieldName = "@Socname";
            dis.Value = socname;
            paramField.CurrentValues.Add(dis);
            //bs.SetParameterValue("@From_date", fromdate);
            //bs.SetParameterValue("@To_date", todate);
            bs.SetDataSource(table.DefaultView);
            crystalReportViewer1.ReportSource = bs;
            crystalReportViewer1.Refresh();

Thanks in Advance.....