请更正我的vb 6编码 [英] please correct my vb 6 coding
本文介绍了请更正我的vb 6编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Private Sub Form_Activate()
Dim nodX As Node
Set nodX = TreeView1.Nodes.Add(, , "root", "Chart")
Set nodX = TreeView1.Nodes.Add("root", tvwChild, "child1", "Details")
Set RS1 = New ADODB.Recordset
RS1.Open "SELECT * FROM CHACCOUNT WHERE LEVELNO=1", CON, adOpenKeyset, adLockOptimistic
If RS1.RecordCount > 0 Then
Dim C
C = 1
RS1.MoveFirst
Do Until RS1.EOF
Set nodX = TreeView1.Nodes.Add("child1", tvwChild, "child1-" & C & RS1!CODE, RS1!BUYER_NAME)
Set RS2 = New ADODB.Recordset
RS2.Open "SELECT * FROM CHACCOUNT WHERE LEVELNO=2", CON, adOpenKeyset, adLockPessimistic
If RS2.RecordCount > 0 Then
Dim D
D = 1
RS2.MoveFirst
Do Until RS2.EOF
Set nodX = TreeView1.Nodes.Add("child1-" & C & RS1!CODE, tvwChild, "child1-" & C & "-" & D & RS2!CODE, RS2!BUYER_NAME)
Set RS3 = New ADODB.Recordset
RS3.Open "SELECT * FROM CHACCOUNT WHERE LEVELNO=3", CON, adOpenKeyset, adLockOptimistic
If RS3.RecordCount > 0 Then
Dim E
E = 1
RS3.MoveFirst
Do Until RS3.EOF
Set nodX = TreeView1.Nodes.Add("child1-" & C & "-" & D & RS2!CODE, tvwChild, "child1-" & C & "-" & D & "-" & E & RS3!CODE, RS3!BUYER_NAME)
Set RS4 = New ADODB.Recordset
RS4.Open "SELECT * FROM CHACCOUNT WHERE LEVELNO=4", CON, adOpenKeyset, adLockOptimistic
If RS4.RecordCount > 0 Then
Dim F
F = 1
RS4.MoveFirst
Do Until RS4.EOF
Set nodX = TreeView1.Nodes.Add("child1-" & C & "-" & D & "-" & E & RS3!CODE, tvwChild, "child1-" & C & "-" & D & "-" & E & "-" & F & RS4!CODE, RS4!BUYER_NAME)
F = F + 1
RS4.MoveNext
Loop
End If
RS4.Close
Set RS4 = Nothing
E = E + 1
RS3.MoveNext
Loop
End If
RS3.Close
Set RS3 = Nothing
D = D + 1
RS2.MoveNext
Loop
End If
RS2.Close
Set RS2 = Nothing
C = C + 1
RS1.MoveNext
Loop
End If
RS1.Close
Set RS1 = Nothing
End Sub
推荐答案
在调试器下运行它.无论您遇到什么问题,都将在您逐步执行代码时显示出来.
Run it under the debugger. Whatever your problem is will be revealed as you step through the code.
您是否编写了原始代码.如果是的话,我认为您应该考虑对其进行重构.
这是要维持的虚拟噩梦.
您在某处遇到错误,但找不到它.
想想其他人调试和发现相同错误会有多困难.
Did you write the original code. If yes, I think you should look at refactoring it.
This is a virtual nightmare to maintain.
You are getting an error somewhere, but you cannot find it.
Think of how difficult it would be for someone else to debug and find the same error.
这篇关于请更正我的vb 6编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文