Can't Solve "sqlparameter Is Already Contained By Another Sqlparametercollection"
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. a
Solution 1:
You are trying to add a SqlParameter to a SqlParameterCollection twice. This may or may not be happening across threads.
If this is a multi-threading issue then all your variables should be scoped locally because, if they are not you should be implemeting sychronisation on thier access, probably with lock.
If this is not a concurrency problem the issue should easily be identified by doing a Find All References on your SqlParameter variable.
Either way we can help you more if you post some code.
Solution 2:
Dont share the same sql objects between 2 thread. Use the pool collection by SQL
Post a Comment for "Can't Solve "sqlparameter Is Already Contained By Another Sqlparametercollection""