请各位大神抽出一分钟,帮忙看下问题在哪呢?
问题描述
**用vb写“用户管理”窗体,“注册用户”运行正常,注册了名叫lucy的用户,然后点击“删除现有用户”删除lucy,
**
**
显示Adodc1.Recordset.RecordCount=0?**
** 提示“当前数据库没有可删除的用户信息”**
可lucy用户是我刚刚才注册的用户,查看SQL也确实有lucy的数据,
为什么Adodc1.Recordset.RecordCount=0?
详细代码
'删除现有用户的确定事件
Private Sub CmdSure2_Click()
rtn = SetWindowPos(Me.hwnd, -2, 0, 0, 0, 0, 3) '取消置前
'禁止删除当前用户
If Combo1.Text = Name1 Then
MsgBox "不能删除当前用户", vbInformation, "系统提示"
Else
a = MsgBox("您确定要删除该用户吗?", vbCritical + vbOKCancel, "系统提示")
If a = vbOK Then
'查询数据库,并将结果放进Adodc1.RecordSource中
Adodc1.RecordSource = "select * from tb_enter where vchUserName = ' " & Combo1.Text & " ' "
Adodc1.Refresh '刷新
'语法没问题,但是不会执行到这一步,无法删除用户信息
MsgBox Adodc1.Recordset.RecordCount '查看记录集的记录条数
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Delete '删除记录集中的数据
Adodc1.Refresh
MsgBox "用户信息删除成功", vbExclamation, "系统提示"
Unload Me
Else
MsgBox "当前数据库没有可删除的用户信息"
End If
End If
End If
End Sub
望各位大神不吝赐教呀!!!谢谢啦