Exemplo n.º 1
0
        public List <T> ReturnListFromNonQuery <T>(string query) where T : class
        {
            dt.Clear();
            SqlCommand     cmd = new SqlCommand(query, Connection.Connect());
            SqlDataAdapter da  = new SqlDataAdapter(cmd);

            cmd.CommandType = CommandType.StoredProcedure;
            da.Fill(dt);
            List <T> list = Comman.ConvertDataTable <T>(dt);

            return(list);
        }
Exemplo n.º 2
0
        public List <T> ReturnListFromParameters <T>(string query, SqlParameter[] param) where T : class
        {
            dt.Clear();
            SqlCommand cmd = new SqlCommand(query, Connection.Connect());

            cmd.CommandType = CommandType.StoredProcedure;
            foreach (SqlParameter para in param)
            {
                cmd.Parameters.Add(para);
            }
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(dt);
            List <T> list = Comman.ConvertDataTable <T>(dt);

            return(list);
        }