// Loading data from database into comboBoxRoomType private void LoadDataFloorplanHall() { // Fetch dataset DataSet halltypeListDS = DBGetData.GetHalltypeList(); if (halltypeListDS != null) { // No tables fetched if (halltypeListDS.Tables.Count == 0) { MessageBox.Show("No halltype datatable found, contact administrator."); return; } // No rows fetched else if (halltypeListDS.Tables[0].Rows.Count == 0) { MessageBox.Show("No datarows found in halltype table."); return; } // Set the dataset as source for combobox comboBoxHallType.ValueMember = "hall_typeid"; comboBoxHallType.DisplayMember = "name"; comboBoxHallType.DataSource = halltypeListDS.Tables[0]; } }
// Loading data from database into comboBoxRoomType private void LoadDataHall() { // Fetch dataset DataSet halltypeListDS = DBGetData.GetHalltypeList(); if (halltypeListDS != null) { // No tables fetched if (halltypeListDS.Tables.Count == 0) { MessageBox.Show("No halltype datatable found, contact administrator."); return; } // No rows fetched else if (halltypeListDS.Tables[0].Rows.Count == 0) { MessageBox.Show("No datarows found in halltype table."); return; } // Set the dataset as source for combobox comboBoxHallType.ValueMember = "hall_typeid"; comboBoxHallType.DisplayMember = "name"; comboBoxHallType.DataSource = halltypeListDS.Tables[0]; } // Highlight existing values MySqlDataReader getValues = DBGetData.GetFloorplanHallData(hallid); if (getValues.Read()) { textBoxHallname.Text = getValues.GetString(0); comboBoxHallType.SelectedValue = getValues.GetInt32(1); } getValues.Dispose(); }