private void loadTable() { dgvPendingRental.DataSource = dt; // Populate table headers dgvSearch.DataSource = searchDT; string query = "SELECT equipmentID AS Equipment, description AS Description, available AS Available FROM Equipment WHERE (location = 'Warehouse 1' AND equipmentStatus = 'In Stock')"; db.fill(dgvSearch, query); }
/* Create and populate Data Grid View headers * * ***************************************/ private void populateInventoryTable() { inventorySearchTable.Columns.Add("Item Number", typeof(int)); inventorySearchTable.Columns.Add("Description", typeof(string)); inventorySearchTable.Columns.Add("Number Available", typeof(int)); intentoryTable.DataSource = inventorySearchTable; // Populate table headers string query = "SELECT itemID AS 'Item Number', description AS Description, currentStock AS 'Number Available' FROM Materials WHERE (location = 'Warehouse 1' AND currentStock > 0)"; dbconn.fill(intentoryTable, query); }
private void txtSearchEmployee_TextChanged(object sender, EventArgs e) { if (txtSearchEmployee.Text != null) { string query = "SELECT employeeID, firstName, lastName, username, rank, employeeStatus FROM Employees WHERE CONCAT(firstName, ' ', lastName) LIKE '%" + txtSearchEmployee.Text + "%'"; db.fill(dgvSearchEmployees, query); } else { } }
private void btnSubimit(object sender, EventArgs e) { if (cbSelectTable.Text != "") { string table = cbSelectTable.Text; string query = "SELECT * FROM " + table + " WHERE description LIKE '%" + txtKeyword.Text + "%'"; mydb.fill(searchTable, query); lblError.Text = null; } else { lblError.Text = "An error has occurred. Please fill out all fields."; } }