Sql Parameter Collection
问题 I have 5 parameters and I want to send them to the method: public static SqlCommand getCommand(string procedure, SqlParameter[] parameter) { Sqlcommand cmd; return cmd } Can I send these paramters at one time like this? SqlParameterCollection prm; prm.Add(p1); prm.Add(p2); prm.Add(p3); prm.Add(p4); prm.Add(p5); sqlcommand cmd = getCommand(prm); 回答1: Or create an array of parameters by hand: SqlParameter[] parameter = { new SqlParameter(...), new SqlParameter(...), new SqlParameter(...) }; But