private void frmDanhSachbenhNhanTheoTen_Load(object sender, EventArgs e) { DataTable dt = new DataTable(); KetNoi kn = new KetNoi(); // dt = kn.laybang("SELECT tblBenhnhan.PK_iBenhnhanID, tblBenhnhan.sHoten, tblBenhnhan.bGioitinh, tblBenhnhan.sDiachi, tblBenhnhan.iSDT, tblBenhnhan.dNgaysinh, tblKhoa.PK_iKhoaID, tblKhoa.sTenKhoa FROM tblBenhnhan INNER JOIN tblKhoa ON tblBenhnhan.PK_iBenhnhanID = tblKhoa.PK_iBenhNhanID"); dt = kn.laybang("select * from tblBenhNhan"); rpDSBenhNhan rp = new rpDSBenhNhan(); rp.SetDataSource(dt); crystalReportViewer1.ReportSource = rp; }
private void btnbaocao_Click_1(object sender, EventArgs e) { if (txtenBN.Text == "") { MessageBox.Show("Bạn chưa nhập tên bệnh nhân!!!"); } else { DataTable dt = new DataTable(); KetNoi kn = new KetNoi(); dt = kn.laybang("select * from tblBenhNhan where sHoten ='" + txtenBN.Text + "'"); rpDSBenhNhan rp = new rpDSBenhNhan(); rp.SetDataSource(dt); crystalReportViewer1.ReportSource = rp; } txtenBN.Clear(); }