Do While Not rs1.EOF
If rs1(0) <> cat1 Then ' 第一層
TreeView1.Nodes.Add "電話簿", tvwChild, rs1(0), rs1(0), "ROOT"
cat1 = rs1(0)
End If
If rs1(0) = cat1 And rs1(1) <> cat2 Then '第二層
TreeView1.Nodes.Add cat1, tvwChild, cat1 + rs1(1), rs1(1), "CHILD"
cat2 = rs1(1)
End If
If rs1(0) = cat1 And rs1(1) = cat2 And rs1(2) <> cat3 Then '第三層
TreeView1.Nodes.Add cat1 + cat2, tvwChild, cat1 + cat2 + rs1(2), rs1(2), "CHILD"
cat3 = rs1(2)
End If
rs1.MoveNext
Loop
'讀取資料並 Show 於 Datagrid
g_sql = "select c_cust.cust_name,c_cust.area,c_cust.ck_name,c_cust.cp_name, c_lman2.l_class,c_lman2.L_name,c_lman2.L_tel" & _
" from c_cust ,c_lman2 where c_cust.cust_no=c_lman2.custno"
rs1.Close
If make_i(g_sql) = flase Then
MsgBox (db_err)
Unload Me
End If
Dim a_cnt As Integer: a_cnt = 0
Do While Not rs1.EOF
a_cnt = a_cnt + 1
rs1.MoveNext
Loop
rs1.MoveFirst
'顯示進度的 Status Bar
fra_loaded.Visible = True
ProgressBar1.Max = a_cnt
ProgressBar1.Min = 0
ProgressBar1.Value = 0
Do While Not rs1.EOF
'放入後續的查核用的資料
.Col = 4
If opt_1.Value = True Then
.Text = rs1("area") & rs1("ck_name") & rs1("cp_name")
End If
If opt_3.Value = True Then
.Text = rs1("cp_name") & rs1("area") & rs1("ck_name")
End If