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); }
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); }