本文介绍了如何将父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 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事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 14:14