//Load products from database into the datagridview private void loadProduct() { try { String query = "SELECT * FROM group_five.products"; dbConnect db = new dbConnect(); dgvPDBase.DataSource = db.Select(query); ad.Update(dt); } catch (Exception error) { MessageBox.Show(error.Message); } }
//Load products from database into the datagridview private void loadPsProduct() { try { dbConnect db = new dbConnect(); String query = "SELECT * FROM group_five.products WHERE QUANTITY > 0"; dgvEProduct.DataSource = db.Select(query); ad.Update(dt); } catch (Exception error) { MessageBox.Show(error.Message); } }
//Search forProduct private void txtSearch_TextChanged(object sender, EventArgs e) { try { dbConnect db = new dbConnect(); String searchKye = txtSearch.Text; String query = "SELECT * FROM group_five.products WHERE PRODUCT_ID LIKE ('" + searchKye + "%') OR PRODUCT_NAME LIKE ('" + searchKye + "%')"; dgvEProduct.DataSource = db.Select(query); ad.Update(dt); if (txtSearch.Text == "") { loadPsProduct(); } } catch (Exception error) { MessageBox.Show(error.Message); } }