public static IList <TAgenteExtintor> GetTAgenteExtintors(SqlCeConnection conn) { IList <TAgenteExtintor> lttpa = new List <TAgenteExtintor>(); string sql = "SELECT * FROM AgenteExtintor"; using (SqlCeCommand cmd = conn.CreateCommand()) { cmd.CommandText = sql; SqlCeDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { TAgenteExtintor ta = GetTAgenteExtintor(dr.GetInt32(0), conn); lttpa.Add(ta); } } return(lttpa); }
public static TAgenteExtintor GetTAgenteExtintor(string descripcion, SqlCeConnection conn) { TAgenteExtintor ta = null; string sql = String.Format("SELECT * FROM AgenteExtintor WHERE descripcion='{0}'", descripcion); using (SqlCeCommand cmd = conn.CreateCommand()) { cmd.CommandText = sql; SqlCeDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { ta = new TAgenteExtintor(); ta.AgenteExtintorId = dr.GetInt32(0); ta.Descripcion = dr.GetString(2); ta.Abm = dr.GetByte(3); } if (!dr.IsClosed) { dr.Close(); } } return(ta); }