如何将父DataBound事件的值获取到子DataBound事件 [英] How to fetch Parent DataBound event Value to Child DataBound Event

查看:51
本文介绍了如何将父DataBound事件的值获取到子DataBound事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(Parent Grid) Doc_No                            (ChildGrid) Material  Quantity
              112233                                        Pipes       8
                                                            cubes       10
                                                            Piping      20

              123125                                        Pipes       5
                                                            Rcc         2



Doc_No来自 DB ,Material,Quantity来自临时DataTable(material,Quantity).
现在,我的问题是将Parent Grid Doc_No插入我的临时DataTable

这样.



Doc_No is taken from DB, Material,Quantity is from temparory DataTable(material,Quantity).
Now,my question is to inser Parent Grid Doc_No into my temparory DataTable

like this.

Temprory DataTable

Doc_No     Material        Quantity
112233     Pipes           8
112233     cubes           10
......



如何执行此操作,任何人都可以帮助我解决此问题....

在此先感谢....



How to do this can anyone help me to solve this issue....

Thanks in advance....

推荐答案

可能不需要使用临时表,可以使用简单的SELECT查询.如果数据存储在两个不同的表中,例如DocumentDocument_Details,并且它们与Doc_No相关,则可以使用以下内容:
Probably you don''t need to use temporary table, you can use simple SELECT query. If the data are stored in two different tables, like Document and Document_Details and they are related by Doc_No, you can use something like this:
SELECT D.Doc_No, DD.Material, DD.Quantity
FROM Document AS D
    LEFT JOIN Document_Details AS DD ON D.Doc_No = DD.Doc_No



但是,如果您需要它:



But if you need it:

CREATE TABLE #tt (Doc_No INT, Material NVARCHAR(300), Quantity INT)

INSERT INTO #tt (Doc_No, Material, Quantity)
SELECT D.Doc_No, DD.Material, DD.Quantity
FROM Document AS D
    LEFT JOIN Document_Details AS DD ON D.Doc_No = DD.Doc_No

SELECT *
FROM #tt

DROP TABLE #tt


这篇关于如何将父DataBound事件的值获取到子DataBound事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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