要做一个学生成绩查询的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