public bool Load(TypeOrder objtypeorder) { bool ret = false; DBase.CommandText = "SELECT * FROM " + TableName + " where IdTypeOrder=@IdTypeOrder ORDER BY Number "; DBase.Parameters["IdTypeOrder"].Value = objtypeorder.Id; try { SqlCeDataReader rdr = DBase.ExecuteReader(); if (rdr != null) { while (rdr.Read()) { objtypeorder.ListPole.Add(new TypeOrderPole(Convert.ToInt32(rdr["Id"].ToString()), Convert.ToInt32(rdr["IdTypeOrder"].ToString()), Convert.ToInt32(rdr["Number"].ToString()), rdr["NamePole"].ToString())); } } rdr.Close(); ret = true; } catch (Exception e) { MessageBox.Show(e.Message, "Внимание!"); } return(ret); }