private void ReloadData(ref ListExh list) { for (var i = 0; i < list.exhibitions.Count; i++) { dataExhibitions.Rows.Add(list.exhibitions[i].Author, list.exhibitions[i].Type, list.exhibitions[i].Genre); } }
public ViewExhibitions() { InitializeComponent(); db = new DB(); list = new ListExh(); db.LoadData(ref list); ReloadData(ref list); }
public WorkWithExhibitionsForm() { InitializeComponent(); db = new DB(); list = new ListExh(); dataGridExh = dataExh; db.LoadData(ref list); ReloadData(ref list); }
public void LoadData(ref ListExh list) { list.exhibitions.Clear(); OpenConnect(); string query = "SELECT * FROM `exhibitions`"; MySqlCommand command = new MySqlCommand(query, GetConnection()); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { list.exhibitions.Add(new Exhibition(reader[1].ToString(), reader[2].ToString(), reader[3].ToString())); } reader.Close(); CloseConnect(); }