private void FillAppendixe2() { cboAppendix2.Items.Clear(); string[] orderBy = new string[] { "Appendix2Code" }; ProductAppendix2Collection oA2List = ProductAppendix2.LoadCollection(orderBy, true); oA2List.Add(new ProductAppendix2()); cboAppendix2.DataSource = oA2List; cboAppendix2.DisplayMember = "Appendix2Code"; cboAppendix2.ValueMember = "Appendix2Id"; cboAppendix2.SelectedIndex = cboAppendix2.Items.Count - 1; }
/// <summary> /// Loads a collection of ProductAppendix2 objects from the database. /// </summary> /// <returns>A collection containing all of the ProductAppendix2 objects in the database.</returns> public static ProductAppendix2Collection LoadCollection(string spName, SqlParameter[] parms) { ProductAppendix2Collection result = new ProductAppendix2Collection(); using (SqlDataReader reader = SqlHelper.Default.ExecuteReader(spName, parms)) { while (reader.Read()) { ProductAppendix2 tmp = new ProductAppendix2(); tmp.LoadFromReader(reader); result.Add(tmp); } } return(result); }