如何在winform应用中使用Sql事务 [英] how To Use Sql Transactions in winform aaplication

查看:90
本文介绍了如何在winform应用中使用Sql事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中有Master Details表,因为我一次要插入所有输入.首先我要将数据插入到master表中,然后再将它插入到details表中.
我遇到一个问题,例如主表中的数据被正确填充,并且尝试将数据插入到明细表中时会引发错误并且数据没有存储在明细表中...因为我现在没有使用sql事务,所以我的主表包含在详细信息表中没有详细信息的行,因此这将在尝试获取数据时引发错误...如何解决...请帮助

i have Master Details table in database.on from i am inserting all input at a time.firstly i am inserting data in to master table and after that in details table.
I got a problem like data in master table is filled accurately and while trying to insert data into details table it will raised error and data is not get stored in the details table...as i have not used sql transaction now my Master table contains a row which don''t have details information in details table,so this will raise errors while trying to fetch data...How To Solve this ...Please Help

推荐答案

在ADO.NET中使用事务 [

SQL transactions in .NET[^]

code is of asp.net but you can use codebehind code in C#


这篇关于如何在winform应用中使用Sql事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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