rs_info.MoveFirst
试试看
以下代码我想实现显示前一条记录内容,就是不行,搞得我晕死了!!!说BOF或EOF有一个为真,或当前记录被删除。
Private Sub Command2_Click()
'数据库连接
connStr = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=机动车与驾驶员档案管理"
On Error GoTo errConnect
If conn.State = adStateOpen Then
conn.Close '如果数据库已打开,则关闭
End If
conn.Open connStr '打开数据库
sql = "select * from 信息表"
rs_info.Open sql, conn, adOpenKeyset, adLockPessimistic
If rs_info.BOF Then
MsgBox "这是第一条记录!", vbOKOnly + vbInformation, "提示"
rs_info.MoveFirst
Else
rs_info.MovePrevious
if rs_info.bof then
rs.info.movefirst
end if
Text1.Text = rs_info.Fields(0)
Text2.Text = rs_info.Fields(1)
Text3.Text = rs_info.Fields(2)
Text4.Text = rs_info.Fields(3)
Text5.Text = rs_info.Fields(4)
Text6.Text = rs_info.Fields(5)
Text7.Text = rs_info.Fields(6)
Text8.Text = rs_info.Fields(7)
Text9.Text = rs_info.Fields(8)
Text10.Text = rs_info.Fields(9)
Text11.Text = rs_info.Fields(10)
Text12.Text = rs_info.Fields(11)
End If
GoTo next1
'错误处理
errConnect:
MsgBox Err.Description, vbOKOnly + vbExclamation, "提示"
next1:
End Sub
这样试试.....
我倒...谁用了我的帐号....管理员检查一下..我的账号被盗用了...