Exemple #1
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            using (SqlConnection sqlCon = new SqlConnection(ConnectionString))

                try
                {

                    GroupWise_CrystalReportNew reportDocument = new GroupWise_CrystalReportNew();
                    ParameterField paramField = new ParameterField();
                    ParameterFields paramFields = new ParameterFields();
                    ParameterDiscreteValue paramDiscreteValue = new ParameterDiscreteValue();

                    paramField.Name = "@GroupId";
                    paramDiscreteValue.Value = cbgroupNames.SelectedValue.ToString();

                    paramField.CurrentValues.Add(paramDiscreteValue);
                    paramFields.Add(paramField);
                    paramFields.Add(paramField);
                    crystalReportViewer1.ParameterFieldInfo = paramFields;

                    //string reportPath = Server.MapPath("~/Memberwisrrptfile.rpt");
                    reportDocument.Load("~/GroupWise_CrystalReportNew.rpt");
                    //reportDocument.Load(@"D:\New folder\Loanapp11sep\10092015 Loan\Loan-25-07-2015\source\LoanApplication\LoanApplication\Memberwisrrptfile.rpt");
                    reportDocument.SetParameterValue("@GroupId", cbgroupNames.SelectedValue.ToString());
                    crystalReportViewer1.ReportSource = reportDocument;

                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString());
                }
                finally
                {

                }
        }