franz081227
Member
- Joined
- Sep 1, 2008
- Messages
- 8
- Programming Experience
- Beginner
Guys help me I have this 4 tables. My problem is I have to save the treeNodes in the 4 tables. How can I determine that a specific treenode will be save in one specific table??
The format of the treenodes is like this:
i have a code to retrieve it to the different tables and it's like this
The format of the treenodes is like this:
VB.NET:
Cat_tab
SubCat_tab
SubCat_tab
Exp_tab
Exp_tab
ExpDet_tab
Cat_tab
SubCat_tab
Exp_tab
Exp_tab
ExpDet_tab
i have a code to retrieve it to the different tables and it's like this
VB.NET:
Public Sub B_CAT()
Dim strCat As String
Dim rsCat As New ADODB.Recordset
Dim CatNo As Integer = 0
tvAccounts.Nodes.Clear()
strCat = "Select accountCatNo, accountCatDesc from accountCategory_tab"
With rsCat
.Open(strCat, conn)
Do While Not .EOF
Dim tvNode As New TreeNode
tvNode.Text = .Fields(1).Value
tvAccounts.Nodes.Add(tvNode)
B_SUBCAT(CatNo, .Fields(0).Value)
CatNo += 1
.MoveNext()
Loop
.Close()
End With
End Sub
Public Sub B_SUBCAT(ByVal catno As Integer, ByVal AcctCatNo As Integer)
Dim strSubCat As String
strSubCat = "Select accountSubCatID, accountSubCatDesc from accountSubcategory_tab" & _
" where accountCatNo=" & AcctCatNo
With rsSubCat
.Open(strSubCat, conn)
Do While Not .EOF
Dim tvNode As New TreeNode
Dim strSaveSubCat As String
Dim rsSaveSubCat As New ADODB.Recordset
tvNode.Text = .Fields(1).Value
tvAccounts.Nodes(catno).Nodes.Add(tvNode)
B_EXP(catno, SubCatNo, .Fields(0).Value)
SubCatNo += 1
.MoveNext()
Loop
.Close()
End With
End Sub
Public Sub B_EXP(ByVal catNo As Integer, ByVal subCatNo As Integer, ByVal AcctSubCatID As String)
Dim strExp As String
Dim rsExp As New ADODB.Recordset
Dim expNo As Integer = 0
strExp = "Select expenseID, expensedesc from accountexpense_tab where accountSubCatID='" & AcctSubCatID & "'"
With rsExp
.Open(strExp, conn)
Do While Not .EOF
Dim tvNode As New TreeNode
tvNode.Text = .Fields(1).Value
tvAccounts.Nodes(catNo).Nodes(subCatNo).Nodes.Add(tvNode)
B_EXPDET(catNo, subCatNo, expNo, .Fields(0).Value)
expNo += 1
.MoveNext()
Loop
.Close()
End With
End Sub
Public Sub B_EXPDET(ByVal catNo As Integer, ByVal subcatNo As String, ByVal expNo As Integer, ByVal acctExpID As String)
Dim strExpDet As String
Dim rsExpDet As New ADODB.Recordset
strExpDet = "Select expenseDetailsNo, expenseDetailsDesc from accountexpensedetail_tab where expenseID='" & acctExpID & "'"
With rsExpDet
.Open(strExpDet, conn)
Do While Not .EOF
Dim tvNode As New TreeNode
tvNode.Text = .Fields(1).Value
tvAccounts.Nodes(catNo).Nodes(subcatNo).Nodes(expNo).Nodes.Add(tvNode)
.MoveNext()
Loop
.Close()
End With
End Sub
Last edited by a moderator: