C#.net WinForms [英] C#.net WinForms

查看:67
本文介绍了C#.net WinForms的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个采购订单表格,我必须为此保存/编辑/删除单个表格中的数据.

我已经通过数据绑定和向导开发了此表单.

否如何保存第一个记录,该记录先保存主记录,然后保存子记录,因为两者都有关系

子表的列FK引用主表的Identity列.

我无法保存详细信息.

谢谢,

I have developed a purchase order form for which i have to save/edit/delete data from single form.

i have developed this form by databindings and wizard.

no how to save the first record which saves first the master record and then save the child record, as both have relation

the child table have column FK which refers to the master table Identity column.

I cant save the details.

Thanks,

推荐答案

首先,您需要插入父表重新编码.然后,您将获得插入记录的主键,然后将子表记录与父表的主键(FK)插入.
First u need to insert the parent table recodes. Then u get the primary key of inserted record and then insert the child table records with the parent table primary key(FK).



正如Toniyo所说,您可以在单独的存储过程中执行此操作,也可以尝试定义这两个表之间的关系(在向导创建的数据适配器中)

有关关系的更多信息...
Hi,
As Toniyo said, you may either do this in separate Store procedures or try to define relationship between these two table (with in the Data adapter created by the Wizard)

More about Relations ...


这篇关于C#.net WinForms的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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