Private rs As New ADODB.Recordset
Private conn As New ADODB.Connection
Private Sub adminlogin()
Dim sql As String
Dim j As Integer
sql = "select Name,PWD from User Where Name='" & Text1.Text & "' and PWD='" & Text2.Text & "'"
Set rs = conn.Execute(sql)///提示这一行有错误
If rs.EOF And rs.BOF Then
j = j + 1
rs.Close
Set rs = Nothing
MsgBox "密码错误"
If j > 2 Then
MsgBox "连续错误3次!程序将退出"
End
End If
Else
rs.Close
Set rs = Nothing
MsgBox "登录成功"
frmMain.Show
Unload Me
End If
End Sub
Private Sub cmd_Click()
Call adminlogin
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set conn = Nothing
End Sub
Private Sub text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then Call adminlogin
End Sub
懂VB的帮帮忙,适时错误3704,对象关闭时,不允许操作。错误已经标明了,麻烦帮忙看一下。
答案:3 悬赏:0 手机版
解决时间 2021-03-05 16:15
- 提问者网友:愿为果
- 2021-03-05 09:40
最佳答案
- 五星知识达人网友:枭雄戏美人
- 2021-03-05 10:17
请检查conn.state是否为0,是否在使用前没有调用conn.open
全部回答
- 1楼网友:逐風
- 2021-03-05 10:58
要先打开 conn,以后才可以用
conn.open "连接代码...."
- 2楼网友:往事隔山水
- 2021-03-05 10:38
在属性框中设置 名称=frmabout
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯