将sqltransaction用于for循环内的多个语句 [英] Using sqltransaction for multiple statement inside for loop

查看:163
本文介绍了将sqltransaction用于for循环内的多个语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要同时使用for循环在数据库中插入记录,我在for循环之外还有另一个insert语句,现在该如何在其中使用sqltransaction或在其中使用scopetransaction ...
谢谢

Hello all,

I need to use for loop for inserting records in database at the same time i have another insert statement outside for loop, now how can I use sqltransaction there, or can i use scopetransaction there...
Thanks

推荐答案

您需要根据您说的工作流在代码级别使用事务.

此处:
MSDN:本地交易 [在ADO.NET中使用事务 [
You need to use Transactions at code level based on your workflow you say.

Here:
MSDN: Local Transactions[^]
Using Transactions in ADO.NET[^]


这篇关于将sqltransaction用于for循环内的多个语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆