As far as I know, we use SqlTransaction to enable rollback if a statement in a batch of commands fails. My question is, is it necessary to use SqlTransaction when retrieving data/using select statements?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, it is not necessary. Each Sql statement has an implicit transaction. But it can be useful if either the default transaction is not optimal – such as a Read Uncommitted would be better – or if you have multiple reads and you want the data to be consistent – such as separate statements for the summary and detail and you want the detail to add up to the summary.