public List <Images> Images_GetByTop(string Top, string Where, string Order) { List <Data.Images> list = new List <Data.Images>(); Data.Images obj = new Data.Images(); SqlDataReader dr = null; try { using (SqlCommand dbCmd = new SqlCommand("sp_Images_GetByTop", GetConnection())) { dbCmd.CommandType = CommandType.StoredProcedure; dbCmd.Parameters.Add(new SqlParameter("@Top", Top)); dbCmd.Parameters.Add(new SqlParameter("@Where", Where)); dbCmd.Parameters.Add(new SqlParameter("@Order", Order)); dr = dbCmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { list.Add(obj.ImagesIDataReader(dr)); } //conn.Close(); } } } catch (Exception) { } finally { if (dr != null) { dr.Close(); } obj = null; } return(list); }
public List <Images> Images_GetByAll() { List <Data.Images> list = new List <Data.Images>(); Data.Images obj = new Data.Images(); SqlDataReader dr = null; try { using (SqlCommand dbCmd = new SqlCommand("sp_Images_GetByAll", GetConnection())) { dbCmd.CommandType = CommandType.StoredProcedure; dr = dbCmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { list.Add(obj.ImagesIDataReader(dr)); } //conn.Close(); } } } catch (Exception) { } finally { if (dr != null) { dr.Close(); } obj = null; } return(list); }