private void btnTimKiem_Click(object sender, EventArgs e) { if (cbTimKiem.Text == "Mã Thuốc") { dgvThuoc.DataSource = Bus.TimKiemThuoc("SELECT MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.Thuoc,dbo.LoaiThuoc,dbo.NhaCungCap where MaThuoc like '%" + txtTimKiem.Text.Trim() + "%'"); } if (cbTimKiem.Text == "Tên Thuốc") { dgvThuoc.DataSource = Bus.TimKiemThuoc("SELECT MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.Thuoc,dbo.LoaiThuoc,dbo.NhaCungCap where TenThuoc like N'%" + txtTimKiem.Text.Trim() + "%'"); } if (cbTimKiem.Text == "Tên Loại Thuốc") { dgvThuoc.DataSource = Bus.TimKiemThuoc("SELECT MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.Thuoc,dbo.LoaiThuoc,dbo.NhaCungCap where TenLoaiThuoc Like N'%" + txtTimKiem.Text.Trim() + "%'"); } if (cbTimKiem.Text == "Tên NCC") { dgvThuoc.DataSource = Bus.TimKiemThuoc("SELECT MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.Thuoc,dbo.LoaiThuoc,dbo.NhaCungCap where TenNCC like N'%" + txtTimKiem.Text.Trim() + "%'"); } if (cbTimKiem.Text == "Công Dụng") { dgvThuoc.DataSource = Bus.TimKiemThuoc("SELECT MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.Thuoc,dbo.LoaiThuoc,dbo.NhaCungCap where CongDung like N'%" + txtTimKiem.Text.Trim() + "%'"); } if (cbTimKiem.Text == "HSD") { dgvThuoc.DataSource = Bus.TimKiemThuoc("SELECT MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.Thuoc,dbo.LoaiThuoc,dbo.NhaCungCap where HSD like '%" + txtTimKiem.Text.Trim() + "%'"); } if (cbTimKiem.Text == "Nước SX") { dgvThuoc.DataSource = Bus.TimKiemThuoc("SELECT MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.Thuoc,dbo.LoaiThuoc,dbo.NhaCungCap where NuocSX like N'%" + txtTimKiem.Text.Trim() + "%'"); } }
private void btnTimKiem_Click(object sender, EventArgs e) { if (cbTimKiem.Text == "Mã Thuốc") { dgvThuoc.DataSource = Bus.TimKiemThuoc("select MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.LoaiThuoc INNER JOIN dbo.Thuoc ON Thuoc.MaLoaiThuoc = LoaiThuoc.MaLoaiThuoc INNER JOIN dbo.NhaCungCap ON NhaCungCap.MaNCC = Thuoc.MaDVSX WHERE MaThuoc like N'%" + txtTimKiem.Text + "%'"); } if (cbTimKiem.Text == "Tên Thuốc") { dgvThuoc.DataSource = Bus.TimKiemThuoc("select MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.LoaiThuoc INNER JOIN dbo.Thuoc ON Thuoc.MaLoaiThuoc = LoaiThuoc.MaLoaiThuoc INNER JOIN dbo.NhaCungCap ON NhaCungCap.MaNCC = Thuoc.MaDVSX where TenThuoc like N'%" + txtTimKiem.Text.Trim() + "%'"); } if (cbTimKiem.Text == "Tên Loại Thuốc") { dgvThuoc.DataSource = Bus.TimKiemThuoc("select MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.LoaiThuoc INNER JOIN dbo.Thuoc ON Thuoc.MaLoaiThuoc = LoaiThuoc.MaLoaiThuoc INNER JOIN dbo.NhaCungCap ON NhaCungCap.MaNCC = Thuoc.MaDVSX Where TenLoaiThuoc Like N'%" + txtTimKiem.Text.Trim() + "%'"); } if (cbTimKiem.Text == "Tên NCC") { dgvThuoc.DataSource = Bus.TimKiemThuoc("select MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.LoaiThuoc INNER JOIN dbo.Thuoc ON Thuoc.MaLoaiThuoc = LoaiThuoc.MaLoaiThuoc INNER JOIN dbo.NhaCungCap ON NhaCungCap.MaNCC = Thuoc.MaDVSX where TenNCC like N'%" + txtTimKiem.Text.Trim() + "%'"); } if (cbTimKiem.Text == "Công Dụng") { dgvThuoc.DataSource = Bus.TimKiemThuoc("select MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.LoaiThuoc INNER JOIN dbo.Thuoc ON Thuoc.MaLoaiThuoc = LoaiThuoc.MaLoaiThuoc INNER JOIN dbo.NhaCungCap ON NhaCungCap.MaNCC = Thuoc.MaDVSX where CongDung like N'%" + txtTimKiem.Text.Trim() + "%'"); } if (cbTimKiem.Text == "HSD") { dgvThuoc.DataSource = Bus.TimKiemThuoc("select MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.LoaiThuoc INNER JOIN dbo.Thuoc ON Thuoc.MaLoaiThuoc = LoaiThuoc.MaLoaiThuoc INNER JOIN dbo.NhaCungCap ON NhaCungCap.MaNCC = Thuoc.MaDVSX where HSD like '%" + txtTimKiem.Text.Trim() + "%'"); } if (cbTimKiem.Text == "Nước SX") { dgvThuoc.DataSource = Bus.TimKiemThuoc("select MaThuoc,TenThuoc,TenLoaiThuoc,TenNCC,CongDung,HSD,NuocSX FROM dbo.LoaiThuoc INNER JOIN dbo.Thuoc ON Thuoc.MaLoaiThuoc = LoaiThuoc.MaLoaiThuoc INNER JOIN dbo.NhaCungCap ON NhaCungCap.MaNCC = Thuoc.MaDVSX where NuocSX like N'%" + txtTimKiem.Text.Trim() + "%'"); } }