0
Answer

Sending Parameters to crystal reports

shiva shanth

shiva shanth

11y
1k
1
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.....