英语翻译这是一个系统的登陆模块,帮我逐句翻译下每段代码的意思可能要牵扯到数据库,可以的话的描述下十分急的需要用Option ExplicitPrivate logintestCount As Integer '记录错误的登录次数Private Sub
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/27 04:27:25
英语翻译这是一个系统的登陆模块,帮我逐句翻译下每段代码的意思可能要牵扯到数据库,可以的话的描述下十分急的需要用Option ExplicitPrivate logintestCount As Integer '记录错误的登录次数Private Sub
英语翻译
这是一个系统的登陆模块,帮我逐句翻译下每段代码的意思
可能要牵扯到数据库,可以的话的描述下
十分急的需要用
Option Explicit
Private logintestCount As Integer '记录错误的登录次数
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim strSql As String
strSql = " Oper_ID = " & "'" & dcmbOperName.BoundText & "'"
If Not (rctOperatorList.EOF And rctOperatorList.BOF) Then
rctOperatorList.Find (strSql)
If Not (rctOperatorList.EOF Or rctOperatorList.BOF) Then
If Trim(rctOperatorList.Fields("Oper_Pass")) = Trim(txtOperPass.Text) Then
OperaterName = Trim(dcmbOperName.Text) '记录当前用户
frmMain.Show '显示主窗体
Unload Me
Exit Sub
Else
logintestCount = logintestCount + 1
If logintestCount >= 3 Then
MsgBox "您已经登录三次都失败,系统关闭",vbInformation + vbOKOnly,"非法用户"
Unload Me
Exit Sub
Else
txtOperPass.SetFocus
End If
End If
Else
logintestCount = logintestCount + 1
If logintestCount >= 3 Then
MsgBox "您已经登录三次都失败,系统关闭",vbInformation + vbOKOnly,"非法用户"
Unload Me
Exit Sub
Else
txtOperPass.SetFocus
End If
End If
Else
MsgBox "数据库中没有操作用户数据",vbCritical + vbOKOnly,"系统错误"
Unload Me
Exit Sub
End If
End Sub
Private Sub Form_Load()
cmdClose.BackColor = RGB(236,226,216)
cmdOK.BackColor = RGB(209,215,231)
cmdCancel.BackColor = RGB(209,215,231)
If ExcuteSql(rctOperatorList,"select * from OperatorList") = True Then
'
Set dcmbOperName.RowSource = rctOperatorList
dcmbOperName.BoundColumn = "Oper_ID"
dcmbOperName.ListField = "OPer_Name"
dcmbOperName.BoundText = "01"
Else
MsgBox "打开数据库失败,系统关闭!",vbCritical + vbOKOnly,"初始化错误"
Unload Me
End If
End Sub
frmLeavel.tblEmployees.Buttons("modify").Visible = False '窗体上的修改的按钮设置为不可见
frmLeavel.tlbPrint.Left = 30 '窗体frmLeavel上的tlbPrint控件离窗体左边距离为30
全部不懂,最好能象上面那么逐句翻译,发不下的话发半篇也行
各位大哥劳累下多写几个字,拜谢
英语翻译这是一个系统的登陆模块,帮我逐句翻译下每段代码的意思可能要牵扯到数据库,可以的话的描述下十分急的需要用Option ExplicitPrivate logintestCount As Integer '记录错误的登录次数Private Sub
上面有一些语我也不懂,我只把我懂的简单地翻译了一下,希望对你有帮助:
Option Explicit
Private logintestCount As Integer '记录错误的登录次数
Private Sub cmdCancel_Click()
Unload Me '卸载当前窗体(退出当前界面)
End Sub
Private Sub cmdClose_Click()
Unload Me '卸载当前窗体(退出当前界面)
End Sub
Private Sub cmdOK_Click()
Dim strSql As String '定义字符串变量strsql 用于存放查询条件
strSql = " Oper_ID = " & "'" & dcmbOperName.BoundText & "'" '查询条件赋值给strsql字符变量
If Not (rctOperatorList.EOF And rctOperatorList.BOF) Then '当数据库的指针不是EOF状态进和指针不是BOF状态时进行查找
rctOperatorList.Find (strSql) '在数据表(rctoperatorlist是一个数据表类型的对象,已经连接一个数据表)中查找满足条件strsql的数据记录集合,并返回到其结果到rctoperatorlist
If Not (rctOperatorList.EOF Or rctOperatorList.BOF) Then
If Trim(rctOperatorList.Fields("Oper_Pass")) = Trim(txtOperPass.Text) Then '核对数据表中字段为oper_pass的值是否与
txtoperpass文本框中的字符一致,如果相同则
执行以下代码:
'以下代码是密码输入正确时的处理
OperaterName = Trim(dcmbOperName.Text) '记录当前用户
frmMain.Show '显示主窗体
Unload Me
Exit Sub
Else
'以下是密码输入错误的处理
logintestCount = logintestCount + 1 '将logintestcount变量自加1
'判断密码错误次数是否超过或等于三次 如果超过则关闭
If logintestCount >= 3 Then
MsgBox "您已经登录三次都失败,系统关闭", vbInformation + vbOKOnly, "非法用户" '给出提示三次输入密码错误
Unload Me '关闭窗体
Exit Sub '退出此子程序
Else
txtOperPass.SetFocus
End If
End If
Else
logintestCount = logintestCount + 1
If logintestCount >= 3 Then
MsgBox "您已经登录三次都失败,系统关闭", vbInformation + vbOKOnly, "非法用户"
Unload Me
Exit Sub
Else
txtOperPass.SetFocus
End If
End If
Else
MsgBox "数据库中没有操作用户数据", vbCritical + vbOKOnly, "系统错误"
Unload Me
Exit Sub
End If
End Sub
Private Sub Form_Load()
'以下是定义各按钮的颜色
cmdClose.BackColor = RGB(236, 226, 216)
cmdOK.BackColor = RGB(209, 215, 231)
cmdCancel.BackColor = RGB(209, 215, 231)
If ExcuteSql(rctOperatorList, "select * from OperatorList") = True Then
'
Set dcmbOperName.RowSource = rctOperatorList
dcmbOperName.BoundColumn = "Oper_ID"
dcmbOperName.ListField = "OPer_Name"
dcmbOperName.BoundText = "01"
Else
MsgBox "打开数据库失败,系统关闭!", vbCritical + vbOKOnly, "初始化错误"
Unload Me
End If
End Sub
问题补充:frmLeavel.tblEmployees.Buttons("modify").Visible = False '窗体上的修改的按钮设置为不可见
frmLeavel.tlbPrint.Left = 30 '窗体frmLeavel上的tlbPrint控件离窗体左边距离为30
---------------------------
另外 下面我给了我自己编写的一个用户登录代码,供你参考:
Private Sub Cmd_ok_Click()
Dim User As String
Dim Pwd As String
Static Pwd1 As String '当用户名正确时将数据表中的密码保存
Static ncount As Integer
Static Iscan As Boolean
User = Trim(Me.Txt_username.Text)
Pwd = Trim(Me.Txt_password.Text)
If Iscan = True Then GoTo Next1 '如果上次用户名正确则直接跳转到next1处 不用再出入数据表进行核对了
if rs_login.state then rs_login.close '如果数据已经打开则关闭它
rs_login.open "select * from 用户信息",conn,adOpenStatic, adLockOptimistic '连接数据表
Do While (rs_login.EOF = False)
If User = rs_login.Fields("用户名").Value Then
Iscan = True
Pwd1 = rs_login.Fields("密码").Value '从数据库中取出正确的密码以便当再次核对密码时用
End If
If Pwd = Pwd1 And Iscan = True Then
MsgBox "登录成功!", vbOKOnly + vbExclamation, ""
Curr_user = User
Curr_pwd = Pwd
User_Pow = rs_login.Fields("权限").Value
Unload Me
Exit Sub
Else
rs_login.MoveNext
End If
Loop
If Iscan = False Then
MsgBox "对不起,没有此用户!", vbOKOnly + vbExclamation, ""
Me.Txt_username.Text = ""
Me.Txt_password.Text = ""
Me.Txt_username.SetFocus
Exit Sub
End If
Next1:
ncount = ncount + 1
If ncount = 3 Then
MsgBox "密码三次输入错误,非法用户!", vbOKOnly, ""
ncount = 0
Unload Me
Else
If Pwd = Pwd1 Then
MsgBox "登录成功!", vbOKOnly + vbExclamation, ""
Curr_user = User
Curr_pwd = Pwd
User_Pow = rs_login.Fields("权限").Value
Unload Me
Exit Sub
Else
MsgBox "密码第" & ncount & "次输入错误!", vbOKOnly + vbExclamation, ""
Me.Txt_password.Text = ""
Me.Txt_password.SetFocus
End If
End If