主题:帮我看看错哪了?谢谢
Dim cc As Integer
Dim conn As New ADODB.Connection
Dim re As New ADODB.Recordset
Dim slink As String
Private Sub Command1_Click()
Dim sql_1 As String, sql_2 As String
slink = "driver={sql server};server=SQC;uid=sa;pwd=123;database=yx"
conn.Open slink
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "用户名密码不能为空!"
End If
sql_1 = "select * from user_info where user_zh='" + Text1.Text + "' and user_pwd='" + Text2.Text + "'"
Set re = conn.Execute(sql_1)
If re.EOF Then
MsgBox "用户名密码错误"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
cc = cc + 1
If cc > 3 Then
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
MsgBox "登入次数过多,3分钟后可再次登入"
sc = 180
Timer1.Enabled = True
End If
Else
Fputong.Show
End If
conn.Close
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Fmain.Hide
Fmand.Show
End Sub
Private Sub Form_Load()
cc = 0
a = 3
End Sub
Private Sub Label4_Click()
Fmain.Hide
Frege.Show
End Sub
Private Sub Timer1_Timer()
sc = sc - 1
a = a - 1
If sc Mod 60 = 0 Then
MsgBox "可以再次登入"
End If
If sc = 0 Then
MsgBox "可以再次登入"
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Timer1.Enabled = False
End If
End Sub
以上是我写的,登陆==没有问题 就是在登录三次后提示 登入次数过多这里有问题。
首先我错误输入密码三次,第四次后它提示出错,并且锁定了三个按钮。但是 3分钟后 并不解锁,而且过一分钟他也不运行MsgBox "可以再次登入" 这句。请问 老师们 我哪错了?
谢谢(要是有更好的方法,不吝赐教。非常感谢)
Dim conn As New ADODB.Connection
Dim re As New ADODB.Recordset
Dim slink As String
Private Sub Command1_Click()
Dim sql_1 As String, sql_2 As String
slink = "driver={sql server};server=SQC;uid=sa;pwd=123;database=yx"
conn.Open slink
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "用户名密码不能为空!"
End If
sql_1 = "select * from user_info where user_zh='" + Text1.Text + "' and user_pwd='" + Text2.Text + "'"
Set re = conn.Execute(sql_1)
If re.EOF Then
MsgBox "用户名密码错误"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
cc = cc + 1
If cc > 3 Then
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
MsgBox "登入次数过多,3分钟后可再次登入"
sc = 180
Timer1.Enabled = True
End If
Else
Fputong.Show
End If
conn.Close
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Command3_Click()
Fmain.Hide
Fmand.Show
End Sub
Private Sub Form_Load()
cc = 0
a = 3
End Sub
Private Sub Label4_Click()
Fmain.Hide
Frege.Show
End Sub
Private Sub Timer1_Timer()
sc = sc - 1
a = a - 1
If sc Mod 60 = 0 Then
MsgBox "可以再次登入"
End If
If sc = 0 Then
MsgBox "可以再次登入"
Command1.Enabled = True
Command2.Enabled = True
Command3.Enabled = True
Timer1.Enabled = False
End If
End Sub
以上是我写的,登陆==没有问题 就是在登录三次后提示 登入次数过多这里有问题。
首先我错误输入密码三次,第四次后它提示出错,并且锁定了三个按钮。但是 3分钟后 并不解锁,而且过一分钟他也不运行MsgBox "可以再次登入" 这句。请问 老师们 我哪错了?
谢谢(要是有更好的方法,不吝赐教。非常感谢)