Beispiel #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CrystalReport2 rpt = new CrystalReport2();

            rpt.Site = this.Site;
            return(rpt);
        }
        private void crystalReportViewer1_Load(object sender, EventArgs e)
        {
            label2.Text = Form4.agent;
            var             conStr = "server=localhost;user id=root;password=root;database=insurance";
            MySqlConnection cnn    = new MySqlConnection(conStr);

            cnn.Open();
            var sql = "select  agent_id,commission,ph_id,pol_key from sales where agent_id='" + this.label2.Text + "'";
            MySqlDataAdapter dscmd = new MySqlDataAdapter(sql, cnn);

            cnn.Close();
            DataSet2 ds = new DataSet2();

            dscmd.Fill(ds, "DataTable1");
            CrystalReport2 objRpt = new CrystalReport2();

            objRpt.SetDataSource(ds.Tables[0]);
            crystalReportViewer1.ReportSource = objRpt;
            cnn.Close();
        }