目录树的分布加载代码提示:未找到列 [WZ]。WZ是第一级编码,不知道问题出在哪里了。
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim cmb As WinForm.ComboBox
cmd.CommandText = "SELECT Distinct * From {物资字典}"
dt = cmd.ExecuteReader()
Dim tv As WinForm.TreeView = e.Form.Controls("TreeView1")
tv.Nodes.Clear
For Each dr As DataRow In dt.Select("上级编号 Not In (" & dt.GetComboListString("物资编码").Replace("|",",") & ")")
tv.Nodes.Add(dr("物资编码"),dr("物资名称"))
Next
'Dim nd As WinForm.TreeNode
For Each nd As WinForm.TreeNode In tv.Nodes
For Each dr As DataRow In dt.Datarows
If dr("上级编号") = nd.Name Then
nd = tv.Nodes.Add(dr("物资编码"),dr("物资名称"))
End If
Next
Next