public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { rptInThongKe rpt = new rptInThongKe(); rpt.Site = this.Site; return(rpt); }
private void frmINTHONGKE_Load(object sender, EventArgs e) { var query = "SELECT BILLDRINKS.id, BILLDRINKS.timecheckin, BILLDRINKS.timecheckout, " + " BILLDRINKS.idtable," + " BILLDRINKS.billstatus, BILLDRINKS.giamgia, BILLDRINKS.TongTien " + " FROM BILLDRINKS INNER JOIN " + " BILLINFO ON BILLDRINKS.id = BILLINFO.idbill" + " WHERE timecheckin >= '" + Timecheckin + "' and timecheckout <= '" + Timecheckout + "' and billstatus = 1"; //Thực thi câu truy vấn SqlDataAdapter da = new SqlDataAdapter(query, cnn); try { //Khởi tạo một bảng mới để đổ dữ liệu từ da va DataTable tblInThongKe = new DataTable(); da.Fill(tblInThongKe); //Khởi tạo cửa sổ rptInThongKe rpt = new rptInThongKe(); //Lấy dữ liệu từ bảng vào trong report in rpt.SetDataSource(tblInThongKe); crvINTHONGKE.ReportSource = rpt; } catch (SqlException ex) { MessageBox.Show(ex.ToString()); } }