private void btnXem_Click(object sender, EventArgs e) { int t = 0; string thang = cbThang.Text; Int32.TryParse(thang, out t); Report_BL objRpt = new Report_BL(); objRpt.SetDataSource(rpt_srv.report_BL(t).Tables[1]); crystalReportViewer_BL.ReportSource = objRpt; }
private void btnXem_Click(object sender, EventArgs e) { int t = 0; string thang = cbThang.Text; Int32.TryParse(thang, out t); SqlConnection connect; connect = new SqlConnection(@"server=.\SQLEXPRESS; Database=QuanLiCaPhe;integrated security=true"); connect.Open(); SqlDataAdapter da = new SqlDataAdapter(); string query = "SELECT Thang,MaNV,TenNV,TongGioLam,MucLuong,TienLuong FROM tblBangLuong where Thang='" + t + "'"; SqlDataAdapter dscm = new SqlDataAdapter(query, connect); DSBangLuong ds = new DSBangLuong(); dscm.Fill(ds, "tblBangLuong"); connect.Close(); Report_BL objRpt = new Report_BL(); objRpt.SetDataSource(ds.Tables[1]); crystalReportViewer_BL.ReportSource = objRpt; crystalReportViewer_BL.Refresh(); }