public static USStateList Load(string constraint) { USStateList list = new USStateList(); // Debug code // list.Add(new USStateData // ("CONSTRAINT:" + constraint, "DEBUG", 50000000)); using (SqlConnection connection = new SqlConnection(khanCS)) { SqlCommand command = new SqlCommand(SelectStatement(constraint), connection); connection.Open(); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { string name = reader.GetString(0); string abbr = reader.GetString(1); int population = reader.GetInt32(2); list.Add(new USStateData(name, abbr, population)); } } connection.Close(); } return list; }
public Frm_People(Person person) { InitializeComponent(); this.person = person; // Populate and set up the cmbBox_state states = USStateList.States(); this.cmbBox_state.DataSource = states; this.cmbBox_state.DisplayMember = "Name"; this.cmbBox_state.ValueMember = "Abbreviation"; }