vb数据库开发 连接数据库查询问题
Private Sub btnSearch_Click()START:
On Error Resume Next
sName = InputBox("请输入所要查找的姓名", "输入提示")
If sName = "" Then GoTo FINISH
cnn.Open "bxd" '打开数据源
rs.Open "select * from message where name='" & sName & "' ", cnn, adOpenKeyset, adLockOptimistic
If rs.RecordCount = 1 Then
txtHName.Text = sName
txtHPhone.Text = rs.Fields("phone").Value
End If
If rs.RecordCount <= 0 Then
MsgBox "该记录不存在!" + Chr(13) + Chr(10) + "请重新输入", vbOKOnly, "查找失败"
rs.Close
cnn.Close
GoTo START
End If
FINISH:
rs.Close
cnn.Close
End Sub
Private Sub btnFirst_Click()
Adodc1.Recordset.MoveFirst
End Sub
点击btnSearch后,再点击btnFirst就会出现如上图所示的错误。望指教!!!
[ 本帖最后由 二吾 于 2011-5-5 12:09 编辑 ]