Esempio n. 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            var db  = new TestDBEntities();
            var tbl = db.products.Where(a => a.productId == 1);

            CrystalReport2 rpt = new CrystalReport2();

            rpt.SetDataSource(tbl);
            crystalReportViewer1.ReportSource = rpt;
            crystalReportViewer1.RefreshReport();
        }
Esempio n. 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            var           db  = new TestDBEntities();
            var           tbl = db.products;
            BindingSource bs  = new BindingSource();

            bs.DataSource = tbl.ToList();
            CrystalReport2 rpt = new CrystalReport2();

            rpt.SetDataSource(tbl);
            crystalReportViewer1.ReportSource = rpt;
            crystalReportViewer1.RefreshReport();
        }