亲,帮我看看一下vb代码的含义吧,谢谢
Public Sub ReFreshSB()On Error Resume Next
Dim TempSQL As String, TempDB(2) As String
Dim DB As New AdoDB.Recordset
Dim factory As Node, i As Integer
Dim group As Node
Dim person As Node
OrgTree.Nodes.Clear
OrgTree.LineStyle = tvwRootLines
Set factory = OrgTree.Nodes.Add(, , "供水站点列表", "供水站点列表")
Set DB = New Recordset
TempSQL = "SELECT dbo.SWaterSite.Sitenum,dbo.SWaterSite.SiteName, dbo.Area.AreaID,dbo.Area.AreaName ,dbo.Client.UserAccount ,dbo.Client.UserName" _
+ " From dbo.Area INNER JOIN dbo.Client ON dbo.Area.AreaID = dbo.Client.AreaID INNER JOIN dbo.SWaterSite ON dbo.Client.SiteNum = dbo.SWaterSite.SiteNum" _
+ " Order By dbo.SWaterSite.Sitenum,dbo.Area.AreaID,dbo.Client.UserAccount"
DB.Open TempSQL, dfwConn, 3, 3
If Not DB.EOF Then
Set factory = OrgTree.Nodes.Add(, , DB.Fields(0), DB.Fields(1))
Set group = OrgTree.Nodes.Add(factory, tvwChild, DB.Fields(2), DB.Fields(3))
'Set person = OrgTree.Nodes.Add(group, tvwChild, Trim(DB.Fields(4)), Trim(DB.Fields(5)))
TempDB(0) = DB.Fields(0): TempDB(1) = DB.Fields(2): TempDB(2) = DB.Fields(4)
DB.MoveNext
End If
Do While Not DB.EOF
If DB.Fields(0) <> TempDB(0) Then
Set factory = OrgTree.Nodes.Add(, , DB.Fields(0), DB.Fields(1))
Set group = OrgTree.Nodes.Add(factory, tvwChild, DB.Fields(2), DB.Fields(3))
'Set person = OrgTree.Nodes.Add(group, tvwChild, Trim(DB.Fields(4)), Trim(DB.Fields(5)))
ElseIf DB.Fields(2) <> TempDB(1) Then
Set group = OrgTree.Nodes.Add(factory, tvwChild, DB.Fields(2), DB.Fields(3))
'Set person = OrgTree.Nodes.Add(group, tvwChild, Trim(DB.Fields(4)), Trim(DB.Fields(5)))
Else
'Set person = OrgTree.Nodes.Add(group, tvwChild, Trim(DB.Fields(4)), Trim(DB.Fields(5)))
End If
TempDB(0) = DB.Fields(0): TempDB(1) = DB.Fields(2): TempDB(2) = DB.Fields(4)
DB.MoveNext
Loop
For i = 1 To OrgTree.Nodes.Count
OrgTree.Nodes(i).Expanded = False '展开所有节点
Next i
OrgTree.Nodes(1).Selected = True
DB.Close
Set DB = Nothing
End Sub --------------------编程问答-------------------- 简单来说就是构建一个指定根结点的树。 --------------------编程问答-------------------- 亲啊,可以详细说一下吗?急需
补充:VB , 数据库(包含打印,安装,报表)