Skip to main content
 首页 » 编程设计

c#之如何提交sql server中的所有事务

2024年02月13日17bjzhanghao

我需要一次将所有事务提交给 DB。该过程是什么? 在将所有事务提交到后端数据库后,将来自每个用户的请求存储在队列中。 谁能告诉我该怎么做?

编辑:

1.Run the update query for each user to add data to table. 
2.Run the session for n users(10 users). 
3.Store the requests from each user in a queue. 
4.after commit all trnasactions on to backend DB at a time. 

请您参考如下方法:

如果您在 SQL 中使用事务,您可以简单地触发 commit 命令。

您还可以使用 Autocommit完成后自动提交事务。这不会让您触发提交命令。

您可以通过DBCC opentran; 命令找到所有未提交的事务。