这是编写下面这个程序时用到的一段编码 其中BaseConn已经声明过的字符串
不知道是什么意思 运行的时候也是错误的 是不是没有引用什么?
[此贴子已经被作者于2007-9-24 19:28:00编辑过]
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)