I am using 2 threads (from same class) in a windows service. I always getting the same error message:
"The SqlParameter is already contained by another SqlParameterCollection.
at System.Data.SqlClient.SqlParameterCollection.Validate(Int32 index, Object value)
at System.Data.SqlClient.SqlParameterCollection.Add(Object value)
at System.Data.SqlClient.SqlParameterCollection.Add(SqlParameter value)
at DataBaseLayer.SqlDataBaseLayer.FillDataSetFromProcedure(String strStoredProc, ArrayList parameterCollection)
at TestThread.StartThreads()"
I tried to solve the problem by creating new instances of SqlParameters and an Arraylist. I also tried to clear the arraylists at the and of my for loop in the code. This does not solve the problem. I am open to any advice.