Im writing a program that allows people to input a postcode and get different medical services displayed with how far away they are from the inputted postcode.
The postcodes are meant to be stored in a list however I do not know how to check if the list gets populated.
could anyone give me any ideas.
This is the list
private List<string> GetPostcodes(string table)
{
connect = new MySqlConnection(connectionString);
connect.Open();
string selectString = "select postcode from " + table;
MySqlCommand cmd = new MySqlCommand(selectString,connect);
reader = cmd.ExecuteReader();
while (reader.Read())
{
postcodes.Add(reader.GetString("postcode"));
}
connect.Close();
return postcodes;
}
And this is a tester button however it doesnt work
private void Button_Click1(object sender, RoutedEventArgs e)
{
var test1 = GetPostcodes("gpSurgery").ToString();
MessageBox.Show(test1);
}