private void ButtonExistingLocation_Click(object sender, RoutedEventArgs e) { ExistingLocation window = new ExistingLocation(latitude.ToString(), longtitude.ToString()); window.Show(); this.Close(); }
public bool GetExistingLocation() { if (ExistingLocation.Count > 0) { ExistingLocation.Clear(); } try { cmd = new SqlCommand(); con.Open(); cmd.Connection = con; cmd.CommandText = "SELECT name FROM Inventory.Location"; _reader = cmd.ExecuteReader(); while (_reader.Read()) { if (_reader.HasRows) { ExistingLocation.AddFirst(_reader["name"].ToString()); } } Console.WriteLine(@"Row count {0}", ExistingLocation.Count); return(false); } catch (SqlException e) { Console.WriteLine(e.ToString()); return(true); } finally { con.Close(); } }