Why do SQL connection leave parameters in?
Posted
by acidzombie24
on Stack Overflow
See other posts from Stack Overflow
or by acidzombie24
Published on 2010-05-21T01:04:39Z
Indexed on
2010/05/21
1:10 UTC
Read the original article
Hit count: 259
While coding with sqlite everytime i always had the exact number of parameters and when i executed the query i always had 0 parameters after it. I kept using the cmd object and it worked fine.
Now while porting to use sql server (2008) my SqlConnection has parameters left over from a successful command. Why? I seem to be able to create tables without the problem (then again i may have use a clone of an empty cmd since i use recursion). Does SqlCommand always leave the parameters in after a query? This always breaks the following query unless i do parameter.clear().
Should i create a new SqlCommand object? or use parameter.clear() each time? I'm somewhat confused.
© Stack Overflow or respective owner