C# params keywork in datalayer

I have been having to access a lot of stored procedures recently and decided it was time to optimize my datalayer class.  I wanted to be able to call just about any stored procedure, that returns a data set, regardless of how many parameters the stored procedure requires. I wrote the following method using the params keyword.  This worked so well that I think I will use this format for update, insert (ExecuteNonQuery methods) and ExecuteScalar methods. public bool GetLookUpData(string storedProc, string spParms, ref SqlDataReader rdr, params string[] strParms) { string[] Parms = spParms.Split(‘,’); StringBuilder sqlErr = new StringBuilder(); try…
Read more →