No you don't need any lock, but you need to create a new SqlConnection
for each insert. The documentation says that instance members of SqlConnection
are not threadsafe.
Edit2: By beeing NOT threadsafe in the case means that you can not have a single SqlConnection
shared between several threads. But if each thread have its own SqlConnection
the inserts are OK. The database itself adheres to the ACID properties and thus concurrent connections trying to insert data is safe and well defined.
Edit: But you should be careful when removing strange code if you can not figure out why it was written that way in the first place. It could easily have some kind of side effect that is non trivial to figure out by looking at just the database code. But on the other hand, if the code was written by someone who pasted some random code found through Google, then your best bet would be to rewrite the code anyway.