Exemplo n.º 1
0
        public List <Answer> Answer_GetByTop(string Top, string Where, string Order)
        {
            List <Answer> list = new List <Answer>();

            using (SqlCommand dbCmd = new SqlCommand("sp_Answer_getByTop", openConnection()))
            {
                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));
                SqlDataReader dr = dbCmd.ExecuteReader();
                dr.Close();
                dr = dbCmd.ExecuteReader();
                if (dr.HasRows)
                {
                    while (dr.Read())
                    {
                        Answer obj = new Answer();
                        obj.AnswerIDataReader(dr);
                        list.Add(obj);
                    }
                }
                dr.Close();
            }
            return(list);
        }