我想用rst_btophr1.move 3移动到第三条记录上,可总是移到别的记录行。用rst_btophr1.MoveFirst也不能移到第一行。是怎么回事?见代码:Private Sub MSHFlexGrid2_DblClick()
MsgBox MSHFlexGrid2.TextMatrix(MSHFlexGrid2.Row, MSHFlexGrid2.Col) Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rst_btophr1 As New ADODB.Recordset
Dim rst_temp As New ADODB.Recordset '定义一个临时用的记录集
cn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\btophr.mdb"
Set cmd.ActiveConnection = cn
cmd.CommandText = "select * from answer;"
rst_btophr1.Open cmd, , adOpenKeyset, adLockOptimistic
'rst_btophr1.MoveFirst '运行结果不正确
rst_btophr1.Move 3 '运行结果不正确
If rst_btophr1.Fields("备注1").Value = "未读" Then
rst_btophr1.Fields("备注1").Value = "已读"
rst_btophr1.Update
End If
cn.Close
End Sub
MsgBox MSHFlexGrid2.TextMatrix(MSHFlexGrid2.Row, MSHFlexGrid2.Col) Dim cn As New ADODB.Connection
Dim cmd As New ADODB.Command
Dim rst_btophr1 As New ADODB.Recordset
Dim rst_temp As New ADODB.Recordset '定义一个临时用的记录集
cn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\btophr.mdb"
Set cmd.ActiveConnection = cn
cmd.CommandText = "select * from answer;"
rst_btophr1.Open cmd, , adOpenKeyset, adLockOptimistic
'rst_btophr1.MoveFirst '运行结果不正确
rst_btophr1.Move 3 '运行结果不正确
If rst_btophr1.Fields("备注1").Value = "未读" Then
rst_btophr1.Fields("备注1").Value = "已读"
rst_btophr1.Update
End If
cn.Close
End Sub
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货