请高手帮忙看一下哪错了,当运行时老出现对象打不开,不允许操作
Private Sub Form_Load()
Dim db As ADODB.Connection
Set db = New Connection
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\score.mdb;Persist Security Info=False"
Set adors = New Recordset
adors.Open "select * from 班级", db
TreeView1.Nodes.Add , , "root", "浏览"
Do Until adors.EOF
Dim akey As String
Set mnode = TreeView1.Nodes.Add(1, tvwChild)
mnode.Text = adors.Open("班级的名称")
mnode.Key = akey + a
adors.MoveNext
Loop
adors.Close
db.Close
End Sub
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
If Node.Index > 1 Then
Dim db As ADODB.Connection
Set db = New Connection
db.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\score.mdb;Persist Security Info=False"
Set mesrs = New Recordset
Dim sqlString As String
'sqlString = " select 姓名 from 学生 where .学号='" + Node.Text + "'"
sqlString = "select 学生.姓名,学生.学号,学生.性别 from 学生 where 学生.班级='" & Node.Text & "'"
'Mesrs.Open sqlString, db, adOpenStatic, adLockOptimistic
mesrs.Open sqlString, db, adOpenStatic, adLockOptimistic
Set DataGrid1.DataSource = mesrs
Text1.Text = Node.Text
End If
End Sub