Private Sub Command1_Click()
Static a As Integer
Static b As Integer(这个变量没有值,显示我EMPTY,我用监视看的)
Static c As Integer(这个变量没有值,显示我EMPTY,我用监视看的)请问怎么解决这个问题?
Select Case Combo1.ListIndex
Case 0
Adodc1.CommandType = adCmdUnknown
Adodc1.RecordSource = "select * from 管理员 where id='" & Trim(Text1.Text) & "'" & " and password='" & Trim(Text2.Text) & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
MDIForm1.Show
Form1.Hide
Else
MsgBox "帐号和密码有错误,请重新输入!", , "系统提示"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
a = a + 1
If a = 3 Then
MsgBox "你已输入三次错误密码和帐号,即将退出系统!", , "系统提示"
Form1.Hide
Form3.Show
' c = a + b
' If c = 3 Then
' MsgBox "你已输入三次错误密码和帐号,即将退出系统!", , "系统提示"
' Form1.Hide
' Form3.Show
' End If
End If
End If
Case 1
Adodc1.CommandType = adCmdUnknown
Adodc1.RecordSource = "select * from 一般 where id='" & Trim(Text1.Text) & "'" & " and password='" & Trim(Text2.Text) & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
MDIForm1.Show
Form1.Hide
MDIForm1.menu_25.Visible = False
Else
MsgBox "帐号和密码有错误,请重新输入!", , "系统提示"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
b = b + 1
If b = 3 Then
MsgBox "你已输入三次错误密码和帐号,即将退出系统!", , "系统提示"
Form1.Hide
Form3.Show
'c = a + b
' If c = 3 Then
' MsgBox "你已输入三次错误密码和帐号,即将退出系统!", , "系统提示"
' Form1.Hide
' Form3.Show
' End If
End If
End If
End Select
End Sub
Static a As Integer
Static b As Integer(这个变量没有值,显示我EMPTY,我用监视看的)
Static c As Integer(这个变量没有值,显示我EMPTY,我用监视看的)请问怎么解决这个问题?
Select Case Combo1.ListIndex
Case 0
Adodc1.CommandType = adCmdUnknown
Adodc1.RecordSource = "select * from 管理员 where id='" & Trim(Text1.Text) & "'" & " and password='" & Trim(Text2.Text) & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
MDIForm1.Show
Form1.Hide
Else
MsgBox "帐号和密码有错误,请重新输入!", , "系统提示"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
a = a + 1
If a = 3 Then
MsgBox "你已输入三次错误密码和帐号,即将退出系统!", , "系统提示"
Form1.Hide
Form3.Show
' c = a + b
' If c = 3 Then
' MsgBox "你已输入三次错误密码和帐号,即将退出系统!", , "系统提示"
' Form1.Hide
' Form3.Show
' End If
End If
End If
Case 1
Adodc1.CommandType = adCmdUnknown
Adodc1.RecordSource = "select * from 一般 where id='" & Trim(Text1.Text) & "'" & " and password='" & Trim(Text2.Text) & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
MDIForm1.Show
Form1.Hide
MDIForm1.menu_25.Visible = False
Else
MsgBox "帐号和密码有错误,请重新输入!", , "系统提示"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
b = b + 1
If b = 3 Then
MsgBox "你已输入三次错误密码和帐号,即将退出系统!", , "系统提示"
Form1.Hide
Form3.Show
'c = a + b
' If c = 3 Then
' MsgBox "你已输入三次错误密码和帐号,即将退出系统!", , "系统提示"
' Form1.Hide
' Form3.Show
' End If
End If
End If
End Select
End Sub
怎么会事,你知道吗?
A是管理用户输入错误的次数
B是一般用户输入错误的次数
主要是屏蔽掉三次错误的全部可能性,就这样啊。
55555555555.HELP ME!~
而且你的大部分程序都是重复的,需要简练一下,变量使用时最好初始化一下
Case 0
Adodc1.CommandType = adCmdUnknown
Adodc1.RecordSource = "select * from 管理员 where id='" & Trim(Text1.Text) & "'" & " and password='" & Trim(Text2.Text) & "'"Case 1
Adodc1.CommandType = adCmdUnknown
Adodc1.RecordSource = "select * from 一般 where id='" & Trim(Text1.Text) & "'" & " and password='" & Trim(Text2.Text) & "'"End Select Adodc1.Refresh
If Adodc1.Recordset.RecordCount <> 0 Then
MDIForm1.Show
Form1.Hide
MDIForm1.menu_25.Visible = False
Else
MsgBox "帐号和密码有错误,请重新输入!", , "系统提示"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
c = c + 1
If c = 3 Then
MsgBox "你已输入三次错误密码和帐号,即将退出系统!", , "系统提示"
Form1.Hide
Form3.Show
End If
End If
管理用户登陆和一般用户登陆看见的MDI窗体的内容是不一样的,
如果不在CASE里做一下判断,而直接放到CASE外,那么你这么写就不能判断管理用户是看哪些,一般用户又是看哪些内容了,你这样写只要查询到就直接打开MDI了,那个分权限就没用到。呵呵。对吗?~
还有大鸟兄兄有没有QQ或者联系的方式啊,以后有啥不懂的可以直接CALL商量一下,恳请大鸟兄兄成全。