string myConn = "Server=localhost; user id = root; database = a_project"; //Eventhough my program runs with no errors when I use this string as query, but I can't use both attributes on the query (dBuildings, dID). //string dQuery = "select building as dBuildings, id as dId from buildings order by building"; string dQuery = "select building as dBuildings from buildings order by building"; MySqlConnection dConnect = new MySqlConnection(myConn); MySqlCommand dCommand = new MySqlCommand(dQuery, dConnect); MySqlDataReader dReader; try { dConnect.Open(); dReader = dCommand.ExecuteReader(); while (dReader.Read()) { string dBuilding = dReader.GetString("dBuildings"); comboBox1.Items.Add(dBuilding); } dConnect.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)