老师,下面是 afterload 的全部代码。其中,tb1是sqltable,selec t * from {流水} where [_identify] is null
Dim tb1 As Table = Tables(e.Form.name & "_table1")
Dim dtb1 As DataTable = DataTables(e.Form.name & "_table1")
Dim cmd As new SQLCommand
Dim dt As DataTable
cmd.C
cmd.CommandText = "sele ct DISTINCT 委托编号 from {流水}"
dt = cmd.ExecuteReader(True)
If dt.DataCols.Contains("年") = False Then
dt.datacols.Add("年",Gettype(String))
End If
If dt.DataCols.Contains("月") = False Then
dt.datacols.Add("月",Gettype(String))
End If
For Each dr As DataRow In dt.DataRows
Dim s As String = dr("委托编号")
dr("年") = left(s,4)
dr("月") = s.SubString(4,2)
Next
Dim tv As WinForm.TreeView = e.Form.Controls("TreeView1")
tv.BuildTree(dt,"年|月")