| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 379 人关注过本帖
标题:[求助]VB数据库问题 大家帮下忙
只看楼主 加入收藏
shikamaru
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-6-26
收藏
 问题点数:0 回复次数:0 
[求助]VB数据库问题 大家帮下忙

要做一个学生成绩查询的FORM,有学号,姓名,和成绩,
要求可以搜索,上一条,下一条,第一条,末条,查询最高分,
请问
1。设了添加按扭,写完代码后报错说:当前记录不支持更新。这可能是提供程序的限制,也可能是选定锁定类型的限制 怎么解决
2。记录下一条可以运行,但上一条报错说,此环境不允许操作,第一条可以运行,但末条报错说行集不允许反向操作 怎么回师,怎么解决
3.搜索代码怎么写
谢谢
这是我截的图
http://picasaweb.google.com/zyw9726/Vb/photo#5079988984818050962
代码是这样的:
Dim cnscore As Connection
Dim rsscore As Recordset

Private Sub cmd3_Click()
Set cnscore = New Connection
With cnscore
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=C:\Documents and Settings\Administrator\桌面\college\score.mdbersist Security Info=False"
.Open
Set rsscore = New Recordset
rsscore.Open "select*from score order by mathscore desc", cnscore, adOpenKeyset
'adOpenKeyset , adLockOptimistic
' Bind the text boxes to the recordset object
Set txtid.DataSource = rsscore
txtid.DataField = "id"

Set txtname.DataSource = rsscore
txtname.DataField = "name"
Set txtmis.DataSource = rsscore
txtmis.DataField = "misscore"
Set txtmath.DataSource = rsscore
txtmath.DataField = "mathscore"
Set txtvb.DataSource = rsscore
txtvb.DataField = "vbscore"
End With
End Sub

Private Sub cmdbefore_Click()
rsscore.MovePrevious
If rsscore.BOF Then
rsscore.MoveLast
End If
End Sub

Private Sub cmdbehind_Click()
rsscore.MoveNext
If rsscore.EOF Then
rssocre.MoveFirst
End If
End Sub

Private Sub cmdconnect_Click()
Set cnscore = New Connection
With cnscore
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=C:\Documents and Settings\Administrator\桌面\college\score.mdbersist Security Info=False"
.Open

End With
MsgBox "成功!", vbInformation, "Student Details"
Set rsscore = New Recordset
rsscore.Open "select * from score", cnscore
'adOpenKeyset , adLockOptimistic
' Bind the text boxes to the recordset object
Set txtid.DataSource = rsscore
txtid.DataField = "id"

Set txtname.DataSource = rsscore
txtname.DataField = "name"
Set txtmis.DataSource = rsscore
txtmis.DataField = "misscore"
Set txtmath.DataSource = rsscore
txtmath.DataField = "mathscore"
Set txtvb.DataSource = rsscore
txtvb.DataField = "vbscore"
End Sub

Private Sub cmdh1_Click()
Set cnscore = New Connection
With cnscore
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=C:\Documents and Settings\Administrator\桌面\college\score.mdbersist Security Info=False"
.Open
Set rsscore = New Recordset
rsscore.Open "select*from score order by misscore desc", cnscore, adOpenKeyset
'adOpenKeyset , adLockOptimistic
' Bind the text boxes to the recordset object
Set txtid.DataSource = rsscore
txtid.DataField = "id"

Set txtname.DataSource = rsscore
txtname.DataField = "name"
Set txtmis.DataSource = rsscore
txtmis.DataField = "misscore"
Set txtmath.DataSource = rsscore
txtmath.DataField = "mathscore"
Set txtvb.DataSource = rsscore
txtvb.DataField = "vbscore"
End With
End Sub

Private Sub cmdfind_Click()
rsscore.Find "" & Text1.Text & ""
End Sub

Private Sub cmdfirst_Click()
rsscore.MoveFirst

End Sub

Private Sub cmdhighest_Click()

End Sub

Private Sub cmdh3_Click()
Set cnscore = New Connection
With cnscore
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=C:\Documents and Settings\Administrator\桌面\college\score.mdb;Persist Security Info=False"
.Open
Set rsscore = New Recordset
rsscore.Open "select*from score order by vbscore desc", cnscore, adOpenKeyset
'adOpenKeyset , adLockOptimistic
' Bind the text boxes to the recordset object
Set txtid.DataSource = rsscore
txtid.DataField = "id"

Set txtname.DataSource = rsscore
txtname.DataField = "name"
Set txtmis.DataSource = rsscore
txtmis.DataField = "misscore"
Set txtmath.DataSource = rsscore
txtmath.DataField = "mathscore"
Set txtvb.DataSource = rsscore
txtvb.DataField = "vbscore"
End With
End Sub

Private Sub cmdlast_Click()
rsscore.MoveLast

End Sub

Private Sub cmdupdate_Click()
Dim x
x = MsgBox("确定要添加吗", vbYesNo, "score Details")
If x = vbYes Then
rsscore.Update
End If

End Sub

Private Sub Form_Load()

End Sub

搜索更多相关主题的帖子: 数据库 
2007-06-26 10:23
快速回复:[求助]VB数据库问题 大家帮下忙
数据加载中...
 
   



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

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