private void btnIn_Click(object sender, EventArgs e) { DataTable TTKH = bus.LayTTKH("Select * From KhachHang Where MaKH=N'" + cboKhachHang.SelectedValue.ToString() + "'"); if (TTKH.Rows.Count > 0) { if (cboKhachHang.SelectedValue.ToString() == TTKH.Rows[0]["MaKH"].ToString()) { SoDienThoai = TTKH.Rows[0]["DienThoai"].ToString(); } } List <PbaoHanh> lst = new List <PbaoHanh>(); lst.Clear(); for (int i = 0; i < dataGridViewCTPBH.Rows.Count - 0; i++) { PbaoHanh pbaoHanh = new PbaoHanh { MaPhieuBH = txtMaPhieu.Text, TenNV = comboBoxNV.Text, NgayLap = dateTimePickerNgaLap.Text, NgayLay = dateTimePickerNgayLayHang.Text, TenLK = dataGridViewCTPBH.Rows[i].Cells[0].Value.ToString(), SoLuong = int.Parse(dataGridViewCTPBH.Rows[i].Cells[1].Value.ToString()), GhiChu = dataGridViewCTPBH.Rows[i].Cells[2].Value.ToString(), TenKH = cboKhachHang.Text, SDT = SoDienThoai, }; lst.Add(pbaoHanh); } rs.Name = "DataSet3"; rs.Value = lst; Frm_PrintHD frm_in = new Frm_PrintHD(); frm_in.reportViewer1.LocalReport.DataSources.Clear(); frm_in.reportViewer1.LocalReport.DataSources.Add(rs); frm_in.reportViewer1.LocalReport.ReportEmbeddedResource = "DoAnCShap.ReportPhieuBaoHanh.rdlc"; Microsoft.Reporting.WinForms.ReportParameter[] reportParameters = new Microsoft.Reporting.WinForms.ReportParameter[] { new Microsoft.Reporting.WinForms.ReportParameter("ParameterSDT", frm_Setting.txtSDT.Text, true), new Microsoft.Reporting.WinForms.ReportParameter("ParameterWebsite", frm_Setting.txtWebSite.Text, true), new Microsoft.Reporting.WinForms.ReportParameter("ParameterHotline", frm_Setting.txtHotLine.Text, true), new Microsoft.Reporting.WinForms.ReportParameter("ParameterDiaChi", frm_Setting.txtDiaChi.Text, true), }; frm_in.reportViewer1.LocalReport.SetParameters(reportParameters); frm_in.ShowDialog(); }