Пример #1
0
        public static List <T> SelectFromDB <T>(string StoredProcedure)
        {
            SqlCommand sc = new SqlCommand(StoredProcedure, ConnectionString.Connect());

            sc.CommandType = CommandType.StoredProcedure;

            SqlDataAdapter sda = new SqlDataAdapter(sc);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            List <T> list = ORM.ConvertTableIntolist <T>(dt);

            return(list);
        }
Пример #2
0
        public static List <string> SelectFromDb(string StoredProcedure, SqlParameter[] parameters)
        {
            SqlCommand sc = new SqlCommand(StoredProcedure, ConnectionString.Connect());

            sc.CommandType = CommandType.StoredProcedure;
            foreach (SqlParameter item in parameters)
            {
                sc.Parameters.AddWithValue(item.ParameterName, item.Value);
            }
            SqlDataAdapter sda = new SqlDataAdapter(sc);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            List <string> list = ORM.ConvertTableIntolist(dt);

            return(list);
        }