On Tue, 31 Dec 2002 15:02:56 -0800, Chad M. Gross <[EMAIL PROTECTED]> wrote:
>Quick thought. Are you calling the public static SqlParameter[] >GetSpParameterSet method and then using this array of parameters in >multiple calls into the various Execute methods. One hole I see is that >the Execute methods that take the SqlParameter[] as a parameter, it does >do a cmd.Parameters.Clear() but this is not part of a try/finally block. >So it's possible that a prior cmd.Execute method throws an exception and >the parameters are not cleared. But if you are always using the methods >that derive an array of parameters from the cache by cloning them, >you "shouldn't" have a problem. > >-Chad Well, we allocate a new array of SqlParmeters every single time and I don't think that the function that's throwing the exception gets any simpler than this: public static void Foo(int blah) { SqlParameter[] arrParameters = new SqlParameter[1]; arrParameters[0] = new SqlParameter( "@XXXXX", SqlDbType.Int ); arrParameters[0].Value = blah; SqlHelper.ExecuteNonQuery("connection string", CommandType.StoredProcedure, "SP Name", arrParameters ); } You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or subscribe to other DevelopMentor lists at http://discuss.develop.com.