private void cmbItem_SelectedIndexChanged(object sender, EventArgs e) { dbClass db = new dbClass(); System.Data.DataTable dt = db.dbSelect($"Select * FROM Items WHERE slot='{cmbSlot.Text}' AND owner='{cmbOwner.Text}' AND name='{cmbItem.Text}'"); this.selectedItemPrice = dt.Rows[0][2].ToString(); lblAvailable.Text = dt.Rows[0][4].ToString(); }
private void getOwnerList() { dbClass db = new dbClass(); System.Data.DataTable owners = db.dbSelect("SELECT id as 'uid', name as 'Owner Name', contact as 'Contact Number' FROM Owners"); dataGridViewOwners.DataSource = owners; dataGridViewOwners.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridViewOwners.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridViewOwners.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; }
private void getItemList() { dbClass db = new dbClass(); System.Data.DataTable items = db.dbSelect("SELECT id as 'uid', name as 'Item Name', price as 'Price', owner as 'Owner', quantity as 'Quantity', slot as 'Slot Number' FROM Items"); dataGridViewItems.DataSource = items; dataGridViewItems.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridViewItems.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridViewItems.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridViewItems.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridViewItems.Columns[4].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; dataGridViewItems.Columns[5].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; }
private void getOwners() { try { dbClass db = new dbClass(); System.Data.DataTable dt = db.dbSelect("Select * FROM Owners"); for (int i = 0; i < dt.Rows.Count; i++) { cmbItemOwner.Items.Add(dt.Rows[i]["name"]); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void getSlot() { try { dbClass db = new dbClass(); System.Data.DataTable dt = db.dbSelect($"Select * FROM Items"); for (int i = 0; i < dt.Rows.Count; i++) { cmbSlot.Items.Add(dt.Rows[i]["slot"]); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void getItems() { cmbItem.Items.Clear(); try { dbClass db = new dbClass(); System.Data.DataTable dt = db.dbSelect($"Select * FROM Items WHERE slot='{cmbSlot.Text}' AND owner='{cmbOwner.Text}'"); for (int i = 0; i < dt.Rows.Count; i++) { cmbItem.Items.Add(dt.Rows[i]["name"]); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }