Public Function TO_FILL_TREE_VIEW(var_TreeView As Control)
' Çàãðóçêà ãðóïï òîâàðîâ
Dim rst As ADODB.Recordset
Dim strParentID As String
Dim strID As String
Dim strName1 As String
Set rst = New ADODB.Recordset
rst.Open "SELECT COMODITY_GROUP_TBL.* FROM COMODITY_GROUP_TBL ", GLB_con, adOpenKeyset, adLockOptimistic
Do Until rst.EOF
strParentID = NZVB(rst("GROUP_Parent"))
If strParentID = "0" Or strParentID = "" Then
strID = "root" & rst("ID_GROUP")
strName1 = rst("GROUP_NAME")
var_TreeView.Nodes.Add , , strID, strName1
var_TreeView.Nodes.Item(strID).Expanded = True
Else
strID = "root" & rst("ID_GROUP")
strName1 = rst("GROUP_NAME")
' вот тута приотсутствии strParentID (родителя)
' Возникает ошибочка
var_TreeView.Nodes.Add "root" & strParentID, tvwChild, strID, strName1
End If
rst.MoveNext
Loop
rst.Close
End Function
|