Example #1
0
        public List <ViewTemas> GetMadeTopics(int id)
        {
            List <ViewTemas> views = new List <ViewTemas>();
            String           sql   = "Select TOP 5 *From VIEW_TEMAS_USUARIO where id_user = '******' ORDER BY id_topic DESC";

            using (SqlConnection connection = BD.getConnection())
            {
                SqlCommand Comando = new SqlCommand(string.Format(sql, id), connection);

                SqlDataReader reader = Comando.ExecuteReader();
                while (reader.Read())
                {
                    ViewTemas view = new ViewTemas();
                    view.id_topic  = reader.GetInt32(0);
                    view.nameTopic = reader.GetString(1);
                    view.id_user   = reader.GetInt32(2);
                    view.nameUser  = reader.GetString(3);
                    views.Add(view);
                }
            }

            return(views);
        }
Example #2
0
        public List<ViewTemas> GetMadeTopics(int id)
        {
            List<ViewTemas> views = new List<ViewTemas>();
            String sql = "Select TOP 5 *From VIEW_TEMAS_USUARIO where id_user = '******' ORDER BY id_topic DESC";
            using (SqlConnection connection = BD.getConnection())
            {
                SqlCommand Comando = new SqlCommand(string.Format(sql, id), connection);

                SqlDataReader reader = Comando.ExecuteReader();
                while (reader.Read())
                {

                    ViewTemas view = new ViewTemas();
                    view.id_topic = reader.GetInt32(0);
                    view.nameTopic = reader.GetString(1);
                    view.id_user = reader.GetInt32(2);
                    view.nameUser = reader.GetString(3);
                    views.Add(view);
                }
            }

            return views;
        }