private void btnSearch_Click(object sender, EventArgs e) { string search = txtSearch.Text; BlockController blockController = new BlockController(); BlockBuilding block = blockController.SearchBlock(search); txtBlockId.Text = block.getBlockId(); txtBlockName.Text = block.getBlockName(); txtGender.Text = block.getGender(); txtDescription.Text = block.getDescription(); txtStatus.Text = block.getStatus(); }
public Boolean UpdateBlock(BlockBuilding block) { Boolean isUpdated = false; string query = "update tblblock set name='" + block.getBlockName() + "', " + "gender='" + block.getGender() + "'," + "description='" + block.getDescription() + "'," + "status='" + block.getStatus() + "'where blockId='" + block.getBlockId() + "';"; try { databaseConnection.Open(); commandDatabase = new MySqlCommand(query, databaseConnection); int updatedRow = commandDatabase.ExecuteNonQuery(); if (updatedRow > 0) { isUpdated = true; } databaseConnection.Close(); } catch (Exception ex) { MessageBox.Show("Query Error : " + ex.Message); } return(isUpdated); }