Пример #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CrystalReport2 rpt = new CrystalReport2();

            rpt.Site = this.Site;
            return(rpt);
        }
Пример #2
0
        private void frmCrystal_Load(object sender, EventArgs e)
        {
            cnn       = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=QLShopTheThao;Integrated Security=True");
            da        = new SqlDataAdapter("Select * from db_HoaDon", cnn);
            dt_hoadon = new DataTable();
            da.Fill(dt_hoadon);

            da.SelectCommand.CommandText = " select hd.MaHD,kh.TenKH,sp.TenSP,ctdh.SoLuong,TongTien,ThanhTien "
                                           + " from db_HoaDon hd join db_ChiTietDonHang ctdh on hd.MaHD = ctdh.MaHD join db_KhachHang kh on hd.MaKH = kh.MaKH, db_SanPham sp"
                                           + " where hd.MaKH = kh.MaKH and hd.MaHD = ctdh.MaHD and sp.MaSP = ctdh.MaSP";

            dt_chitiethoadon = new DataTable();
            da.Fill(dt_chitiethoadon);

            CrystalReport2 rpt = new CrystalReport2();

            rpt.SetDataSource(dt_chitiethoadon.DefaultView);
            crystalReportViewer1.ReportSource = rpt;
        }