标题:[求助]
只看楼主
随云
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2005-3-16
结帖率:100%
 问题点数:0 回复次数:2 
[求助]

请高手帮忙看一下哪错了,当运行时老出现对象打不开,不允许操作

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

搜索更多相关主题的帖子: False 
2005-12-14 15:24
VB爱上我
Rank: 6Rank: 6
等 级:贵宾
威 望:25
帖 子:478
专家分:52
注 册:2005-10-14
得分:0 
Dim db As ADODB.Connection
dim adors as adodb.recordset
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

IT618资讯网 提供服务端开发,前端开发,网页特效,热门开源系统研究,软件下载,站长建站,淘宝开店等学习资料.
2005-12-16 04:47
随云
Rank: 1
等 级:新手上路
帖 子:44
专家分:0
注 册:2005-3-16
得分:0 
谢谢楼上的,

2005-12-16 10:54



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-38131-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.166664 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved