Creating SqlParameters Best Practices
*NEW* See the updated post at Sharp Developer: Sql Parameters Best Practices
This article summarizes some nice ways to create SqlParameter arrays. When we use SqlHelper, or even without SqlHelper when we use SqlCommands directly, and we want to pass an array of SqlParameters to the function. The method I will discuss does not require you to hard-code the number of elements, nor does it require you to create a temporary list of some sort, but it requires you to have all the values up front that you want to insert into the list.