Reputation: 12102
When is it save to modify a SqlCommand
without modifying the query to be run?
For example, when I have
SqlCommand cmd = getCommand();
con.executeNonQueryAsync();
//later
modifyParameters(cmd);
is it possible that the NonQuery that gets executed sees the modified parameters? If so, is there any synchronization option before the returned task completed for after which modifying the command is guaranteed not to modify the run statement?
Upvotes: 0
Views: 44
Reputation: 12102
No, you can't safely modify an SqlCommand
at any time while a Task
from some Execute*Async
operation on the command hasn't completed yet.
Upvotes: 1