private void button1_Click(object sender, EventArgs e) { TimKiemSanPhamDataContext db = new TimKiemSanPhamDataContext(); var x = from y in db.SANPHAMs where y.TENSP.Contains(textBox1.Text) select y; sANPHAMDataGridView.DataSource = x; }
private void button1_Click(object sender, EventArgs e) { TimKiemSanPhamDataContext db = new TimKiemSanPhamDataContext(); var x = from y in db.KHUYENMAIs where y.MASP.Contains(textBox1.Text) select y; kHUYENMAIDataGridView.DataSource = x; }
private void button2_Click(object sender, EventArgs e) { if (textBox2.Text.Length != 0 && textBox3.Text.Length != 0) { TimKiemSanPhamDataContext db = new TimKiemSanPhamDataContext(); var y = from x in db.SANPHAMs where (x.DonGia >= (int.Parse(textBox2.Text))) where (x.DonGia <= (int.Parse(textBox3.Text))) select x; sANPHAMDataGridView.DataSource = y; } else { MessageBox.Show("Vui lòng nhập đầy đủ thông tin"); } }