private void ShowBtn_Click(object sender, EventArgs e) { if (statistic == "Самый востребованный номер") { String data; DB db = new DB(); data = db.PopularRoom(); MessageBox.Show(statistic + ": " + data); } if (statistic == "Рейтинг номеров") { dataGridView2.Rows.Clear(); LoadRaiting(); } if (statistic == "Стоимость проживания") { PriceForm PriceForm = new PriceForm(); PriceForm.Show(); } }
public String PriceCurrentRoom() { openConnection(); String id = PriceForm.num(); string query = "SELECT `Цена за ночь` FROM `номер` WHERE Номер =" + id; MySqlCommand command = new MySqlCommand(query, connection); MySqlDataReader reader = command.ExecuteReader(); String data = ""; while (reader.Read()) { data = reader[0].ToString(); } reader.Close(); closeConnection(); return(data); }