Esempio n. 1
0
        private void Report2()
        {
            //creating an object of ParameterField class
            ParameterField paramField1 = new ParameterField();
            // ParameterField paramField2 = new ParameterField();

            //creating an object of ParameterFields class
            ParameterFields paramFields1 = new ParameterFields();
            // ParameterFields paramFields2 = new ParameterFields();

            //creating an object of ParameterDiscreteValue class
            ParameterDiscreteValue paramDiscreteValue1 = new ParameterDiscreteValue();
            //ParameterDiscreteValue paramDiscreteValue2 = new ParameterDiscreteValue();

            //set the parameter field name
            paramField1.Name = "id";
            // paramField2.Name = "cheque no";

            //set the parameter value
            paramDiscreteValue1.Value = x;
            //paramDiscreteValue2.Value = cmbAccountDNo.Text;



            //add the parameter value in the ParameterField object
            paramField1.CurrentValues.Add(paramDiscreteValue1);
            //paramField2.CurrentValues.Add(paramDiscreteValue2);
            //add the parameter in the ParameterFields object
            paramFields1.Add(paramField1);
            // paramFields2.Add(paramField2);
            //set the parameterfield information in the crystal report



            ReportViewer f2 = new ReportViewer();
            TableLogOnInfos reportLogonInfos = new TableLogOnInfos();
            TableLogOnInfo reportLogonInfo = new TableLogOnInfo();
            ConnectionInfo reportConInfo = new ConnectionInfo();
            Tables tables = default(Tables);
            //	Table table = default(Table);
            var with1 = reportConInfo;
            with1.ServerName = "tcp:KyotoServer,49172";
            with1.DatabaseName = "BankReconciliationDB";
            with1.UserID = "sa";
            with1.Password = "******";
            ABBankCheque cr = new ABBankCheque();
            tables = cr.Database.Tables;
            foreach (Table table in tables)
            {
                reportLogonInfo = table.LogOnInfo;
                reportLogonInfo.ConnectionInfo = reportConInfo;
                table.ApplyLogOnInfo(reportLogonInfo);
            }
            f2.crystalReportViewer1.ParameterFieldInfo = paramFields1;
            //   f2.crystalReportViewer1.ParameterFieldInfo = paramFields2; //set the parameterfield information in the crystal report
            f2.crystalReportViewer1.ReportSource = cr;
            this.Visible = false;

            f2.ShowDialog();
            this.Visible = true;
        }