数据表/DGV父子关系 [英] datatable / DGV parent child relation

查看:100
本文介绍了数据表/DGV父子关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们

我的要求是在一个父数据表中获取发票详细信息(即发票编号,供应商名称,发票金额,日期).然后,该子明细会显示在另一个数据表中(即发票编号,项目代码,金额等).关系是发票编号.我需要直接从datagridview获取输入.子明细项目代码金额不应超过发票金额.

DGV应该以添加方式显示父表,一旦我在父表中添加了详细信息,该行之前就会出现一个加号,按该加号我应该能够直接输入子表的详细信息.

有人可以帮助我如何从DGV获得这些输入.示例代码确实有帮助

在此先感谢

问候
Mohamed Faizal

Hi Guys

My requirement is to get Invoice details in one parent datatable (i.e. Invoice number, Vendor Name, Inv amount, Date). Then the subdetails in another datatable (i.e. invoice number, itemcode, amount, etc). The relation is Invoice Number. I need to get the input directly from a datagridview. Subdetail itemcode amount shouldn''t exceed invoice amount.

The DGV should display the parent table in add mode, once i addded the details in parent table a plus symbol should appear before that row, pressing that plus symbol i should able to enter child table details directly.

Can someone help how do i get these inputs from a DGV. Sample code would really help

Thanks in advance

Regards
Mohamed Faizal

推荐答案

写道:​​

子明细项目代码金额不应超过发票金额

Subdetail itemcode amount shouldn''t exceed invoice amount



插入记录时应进行此检查.不是吗?

如果您的应用程序处理的数据量不太高,则应一次性获得整个父级和子级数据.然后,使用RowEnter或SelectionChanged事件,您可以基于选择内容过滤掉子表中的数据.然后,您可以使用该子数据进行显示/验证.



This check should be done while inserting the records. Isn''t it?

If the amount of data your application deals with is not too high, you should get entire parent and the child data in one go. Then, using RowEnter or SelectionChanged event, you can filter out the data in the child table based on the selection. Then you can use that child data for displaying/validation.


这篇关于数据表/DGV父子关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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