Dim strsql As String
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rsa As New ADODB.Recordset
Dim nodea As Node
Dim nodeb As Node
Private Sub Form_Load()
conn '連接sql數據庫
strsql = "select * from tblhr_unitid"
With rsa
.ActiveConnection = cn
.CursorLocation = adUseClient
.Open strsql, cn, adOpenDynamic, adLockOptimistic
End With
Do While Not rsa.EOF
Set nodea = ctltrv.Nodes.Add(, , rsa("h_classid"), rsa("h_classname"))
rsa.MoveNext
Loopstrsql = "select * from tblhr_basic"
With rs
.ActiveConnection = cn
.CursorLocation = adUseClient
.Open strsql, cn, adOpenDynamic, adLockOptimistic
End With
Do While Not rs.eof
Set nodeb = ctltrv.Nodes.Add(rs("h_classid"), tvwChild, rs("h_id"), rs("h_name"))
rs.movenext
loop
End Sub
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rsa As New ADODB.Recordset
Dim nodea As Node
Dim nodeb As Node
Private Sub Form_Load()
conn '連接sql數據庫
strsql = "select * from tblhr_unitid"
With rsa
.ActiveConnection = cn
.CursorLocation = adUseClient
.Open strsql, cn, adOpenDynamic, adLockOptimistic
End With
Do While Not rsa.EOF
Set nodea = ctltrv.Nodes.Add(, , rsa("h_classid"), rsa("h_classname"))
rsa.MoveNext
Loopstrsql = "select * from tblhr_basic"
With rs
.ActiveConnection = cn
.CursorLocation = adUseClient
.Open strsql, cn, adOpenDynamic, adLockOptimistic
End With
Do While Not rs.eof
Set nodeb = ctltrv.Nodes.Add(rs("h_classid"), tvwChild, rs("h_id"), rs("h_name"))
rs.movenext
loop
End Sub
Set nodeb = ctltrv.Nodes.Add(rs("h_classid"), tvwChild, rs("h_id"), rs("h_name"))