使用分层数据网格 [英] working with hierarchical datagrid

查看:92
本文介绍了使用分层数据网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我的名字是ade,我目前正致力于个人项目(Drycleaning application),它有第三方控件,分层数据网格控件(从应用程序方面下载,控件实际上就像一个数据网格视图控件,但它还包含一个树视图功能,即树视图节点,如结构,以分层格式显示数据(即节点和子节点)。



这就是我构建分层数据网格的方式,其数据以这种格式显示:



Hi all,

My name is ade, am presently working on a personal project(Drycleaning application) which has a third party control, a hierarchical datagrid control (which I download from application aspect), the control is actually like a datagrid view control but also it incorporates a treeview feature, that is treeview view node like structure which displays data in hierarchical format (that is nodes and subnodes).

Here is the thing, the way I structure the hierarchical datagrid has data displayed in this format:

     	Column1  Column2    Column3	Column4

-	1      blouse	     400       0    ----------(node or parent node)
		   Blue		       1     --------(Sub node or child row)
	         Cotton		       1     --------(Sub node or child row)	

-	3      Camisole	     350       0    ----------(node or parent node)
		   White	       2     --------(Sub node or child row)
		   Linen	       2     --------(Sub node or child row)
		   Press Only    175   2     --------(Sub node or child row)

-	2      Dress	     250       0    ----------(node or parent node)
		   Yellow	       3     --------(Sub node or child row)
		   Wool                3    --------(Sub node or child row)
		   Press Only   -125   3     --------(Sub node or child row)

-	2      Shorts	     450       0    ----------(node or parent node)
		   Yellow	       4     --------(Sub node or child row)
		   Wool                4     --------(Sub node or child row)
		   Press Only   -225   4     --------(Sub node or child row)





第一列是数量,第二列是用于物品描述的数量,第三列是相关的成本,第三列是我编码的编号顺序,以上面的格式显示。



现在实现这一点后,我需要将这些数据推送到两个不同的选项卡les,顶部节点或父行,仅在其第四列单元格中具有零条目,并且包含数量(column1),服装名称或服装类型(column2)和成本(column3)的条目转到特定表格和其他项目,如颜色和材料类型以及任何其他服务(例如在这种情况下,只按下另一个表格)。



我尝试了代码,就像我想要的那样,但它会在每一个父行下面的行数上复制这一行。







The first column is for quantities the second is for item description, the third is for cost where relevant and third is for numbering sequence I coded and which displays in the format above.

Now after achieving this I need to have this data pushed to two different tables, the top nodes or parent rows, which has Zero entry in their fourth column cell alone and which contains entry the quantity(column1), garment name or garment type (column2) and cost(column3) goes to a particular table and the the other items like the color and material type and any other service (like in this case press only goes to another table).

I tried the code , just as i want , but it replicates this row on the amount of rows below each individual parent row.


cmdgarmentorderdetails.Connection = cnngarmentcategory
        cnngarmentcategory.Open()

        For i As Integer = 0 To HDGVLaundry.NewRowIndex - 1

            If HDGVLaundry.Rows(i).Cells(4).Value = 0 Then

                GarmentQty = HDGVLaundry.Rows(i).Cells(1).Value
                GarmentDesc = HDGVLaundry.Rows(i).Cells(2).Value
                Garmentcost = HDGVLaundry.Rows(i).Cells(3).Value
                Orderticketid = LblOrderticketID.Text

                cmdgarmentorderdetails.CommandText = "INSERT INTO TblTicketDescDetails(OrderTicketiD,GarmentDesc,GarmentQty,Garmentcost) Values('" & Orderticketid & "','" & GarmentDesc & "' ,'" & GarmentQty & "','" & Garmentcost & "')"

            Else
                cmdgarmentorderdetails.Cancel()
            End If

            cmdgarmentorderdetails.ExecuteNonQuery()

        Next

    End Sub





结果:



Result:

1002             1      blouse      400
1002             1      blouse      400
1002             1      blouse      400
1002             3      Camisole    350
1002             3      Camisole    350
1002             3      Camisole    350
1002             3      Camisole    350
1002             2      Dress       250
1002             2      Dress       250
1002             2      Dress       250
1002             2      Dress       250
1002             2      Shorts      450
1002             2      Shorts      450
1002             2      Shorts      450
1002             2      Shorts      450





而不是像这样:





instead of just like this:

1002             1      blouse      400
1002             3      Camisole    350
1002             2      Dress       250
1002             2      Shorts      450



请问我在做什么错误

提前谢谢

问候



Ade


please what am i doing wrong
Thank you in advance
Regards

Ade

推荐答案

移动这一行:

Move this line:
cmdgarmentorderdetails.ExecuteNonQuery()



<$ c之前$ c> Else 声明;)


这篇关于使用分层数据网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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