不好意思,这台电脑不是我的,打字实在不方便。。。
不过那个拼写有没有错误???
偶学编程,也许本身就是一个错。。。
Option Explicit
Dim gconn As New ADODB.Connection
Dim rs As ADODB.Recordset
Dim rsfield As ADODB.Recordset
Dim matable As String
Dim num As Long
Dim BaseConn As String
Dim chaineconn As String
———————————————————————————————————————————————————
Private Sub Form_Load()
Me.Width = 9840
BaseConn = "Provider=Microsoft.Jet.OLE DB.3.51;Persist Security Info=False;Data Sourcr="
End Sub
————————————————————————————————————————————————
Private Sub Command1_Click()
Dim Node As Node
Dim etape1 As Node
Dim etape2 As Node
cd.Filter = "Base Access|*.mdb"
cd.ShowOpen
chaineconn = BaseConn & cd.FileName
If cd.FileName = "" Then Exit Sub
trv.Nodes.Clear
gconn.Open chaineconn
Set rs = gconn.OpenSchema(adSchemaTables)
Set Node = trv.Nodes.Add(, , , "<Base>", 1, 1)
Node.Expanded = True
Do While Not rs.EOF
Select Case LCase(rs.Fields(3))
Case "table"
num = 2
Case Is = "view"
num = 5
Case "system table"
num = 6
Case Else
num = 4
End Select
Set etape1 = trv.Nodes.Add(Node, tvwChild, , rs.Fields(2).Value, num, num)
Set rsfield = gconn.OpenSchema(adSchemaColumns)
Do While Not rsfield.EOF
If rsfield.Fields(2) = rs.Fields(2) Then
Set etape2 = trv.Nodes.Add(etape1, tvwChild, , rsfield.Fields(3), 3, 3)
End If
rsfield.MoveNext
Loop
rs.MoveNext
Loop
gconn.Close
End Sub
_____________________________________________________________-----________________________________
Private Sub trv_NodeClick(ByVal Node As MSComctlLib.Node)