1 protected SqlParameter[] CreadeSqlParameters(object obj) 2 { 3 List<SqlParameter> list = new List<SqlParameter>(); 4 foreach (PropertyInfo item in obj.GetType().GetProperties()) 5 { 6 string name = item.Name; 7 object value = item.GetValue(obj,null); 8 list.Add(new SqlParameter(name, value)); 9 } 10 return list.ToArray(); 11 }
时间: 2024-10-13 06:33:29