1
Function
getTreeRootId(pNodeId)
2 getSQL = " select note_id,parent_id from [T_tree_demo] where note_id=' " & pNodeId & " ' "
3 Set getRs = db.Execute(getSQL)
4 If Not getRs.eof Then
5 If Trim (getRs( " parent_id " )) = " 0 " Then
6 getTreeRootId = Trim (getRs( " note_id " ))
7 Exit Function
8 Else
9 getTreeRootId = getTreeRootId( Trim (getRs( " parent_id " )))
10 End If
11 Else
12 getTreeRootId = 0
13 Exit Function
14 End If
15 getRs.close
16 Set getRs = Nothing
17 End Function
18
2 getSQL = " select note_id,parent_id from [T_tree_demo] where note_id=' " & pNodeId & " ' "
3 Set getRs = db.Execute(getSQL)
4 If Not getRs.eof Then
5 If Trim (getRs( " parent_id " )) = " 0 " Then
6 getTreeRootId = Trim (getRs( " note_id " ))
7 Exit Function
8 Else
9 getTreeRootId = getTreeRootId( Trim (getRs( " parent_id " )))
10 End If
11 Else
12 getTreeRootId = 0
13 Exit Function
14 End If
15 getRs.close
16 Set getRs = Nothing
17 End Function
18