从代码隐藏更新多个表? [英] update multiple tables from codebehind?

查看:56
本文介绍了从代码隐藏更新多个表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库中有4个表.
我有一个允许插入/更新/删除的formview.我需要做的是在formview更新事件上,我需要使用在formview的文本框中键入一个值来更新其他3个表.这可能吗?以及如何获取文本框的值以传递给其他3个表?

在formview插入中,在所有4个表中插入一个ID,一个名称和一个产品ID.我想通了.我只需要更新名称. ID和产品ID将保持不变.

i have 4 tables in my database.
I have a formview that allows insert/update/delete. What i need to do is on formview updating event, i need to update 3 other tables with a value typed into the textbox on the formview. Is this possible? and how would i get the value of the textbox to pass to the other 3 tables?

the formview insert, inserts an id a name, and a product id into all 4 tables. i got that much figured out. i need only for the name to update. the id and product id will stay the same.

help?

推荐答案

使用事务,然后在其中执行多个更新查询,每次更新需要1个.
Use a transaction and then execute multiple update queries within it, 1 for each update required.


最佳方法要使用触发器.
http://msdn.microsoft.com/en-us/library/ms189799.aspx [ ^ ]
Best Way To Use Trigger.
http://msdn.microsoft.com/en-us/library/ms189799.aspx[^]


这篇关于从代码隐藏更新多个表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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