📄 frm_xidengru.frm
字号:
VERSION 5.00
Begin VB.Form frm_xtglydl
BorderStyle = 3 'Fixed Dialog
Caption = "Form1"
ClientHeight = 5580
ClientLeft = 45
ClientTop = 435
ClientWidth = 9030
Icon = "frm_xidengru.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5580
ScaleWidth = 9030
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdOK
Caption = "登入"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1680
TabIndex = 5
Top = 3960
Width = 2175
End
Begin VB.CommandButton Command2
Caption = "退出"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 5400
TabIndex = 4
Top = 3960
Width = 2175
End
Begin VB.TextBox txtPassword
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
IMEMode = 3 'DISABLE
Left = 3840
PasswordChar = "*"
TabIndex = 1
Top = 2520
Width = 2775
End
Begin VB.TextBox txtUserName
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3840
TabIndex = 0
Top = 1440
Width = 2775
End
Begin VB.Label Label1
Caption = "系统管理员"
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1440
TabIndex = 3
Top = 1320
Width = 1935
End
Begin VB.Label Label2
Caption = "密 码"
BeginProperty Font
Name = "宋体"
Size = 18
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 1440
TabIndex = 2
Top = 2400
Width = 1935
End
End
Attribute VB_Name = "frm_xtglydl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim ok As Boolean
Dim dlsql As String
Dim username1 As String
Dim password1 As String
Dim micount As Integer
Dim db3 As ADODB.Connection
Dim rs3 As ADODB.Recordset
Dim Trim1 As String
Public zzs As String
Public LoginSucceeded As Boolean
Private Sub cmdOK_Click()
Dim fmdlsql As String '定义fmdlsql为字符串类型
username1 = "" '初始化全局变量username的值为空
Trim1 = Trim(txtUserName.Text)
'If txtUserName.Text = "" Then
If Trim1 = "" Then '加入txtusername控件的值为空,提示用户输入
MsgBox "您没有输入系统管理员编号,请输入你的系统管理员名!", vbOKOnly, "警告"
txtUserName.SetFocus '为当txtusername为空时,设焦点到此控件上
Else '当txtusername控件有内容时 则判断输入的用户编号是否存在
Set rs3 = New ADODB.Recordset
fmdlsql = "select * from 系统用户表 where 用户名='" & txtUserName.Text & "'"
rs3.Open fmdlsql, db3, adOpenDynamic, adLockBatchOptimistic
If rs3.EOF = True Then '当rs3.eof为真时,说明输入的用户编号不存在。
MsgBox "用户不存在,请重输!", vbOKOnly, "警告"
txtUserName.Text = "" 'txtusername控件置空
txtUserName.SetFocus
Else '若输入的用户编号存在,则判断存在的用户编号的密码是否与输入到 txtpassword控件的内容相同,
'If rs3.Fields(1) = txtPassword.Text Then
If Trim(rs3.Fields(2)) = Trim(txtPassword.Text) Then
'ok = True
username1 = txtUserName.Text
password1 = txtPassword.Text
'username1 = Trim(txtUserName.Text) '将txtusername控件中的内容赋给全局变量username1
'password1 = Trim(txtPassword.Text) '将txtpassword控件中的内容赋给全局变量password1
'qjbl1 = Trim(rs3.Fields(2).Value) '将登陆用户的权限类型赋给全局变量qjbl1
Unload Me '用户成功登陆时卸载本窗体
frm_manage.Show '显示主窗体
Exit Sub '这句不加化可能三次的话出错
Else
MsgBox "密码输错,请重输!", vbOKOnly, "警告" ' 当rs3.eof为假时,先是提示窗体
txtPassword.Text = "" '清空控件
txtPassword.SetFocus ' 这是焦点
End If
End If
micount = micount + 1 '当输入信息错误,变量micount将加一
If micount = 3 Then '判断是否已经三次登陆错误,如果是则屏蔽cmdok按钮控件
MsgBox "您影响本系统的安全,您的登陆请求将被取消,如有疑问请与管理员联系!"
cmdOK.Enabled = False
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
frm_mainconsole.Show
End Sub
Private Sub Form_Load()
Set db3 = New ADODB.Connection ' 新建connection对象
'db3.ConnectionString= "Provider=SQLOLEDB"&";server="&sServer&";UID="&sLongID&";PWD="&sPassword&";DATABASE=kzms"
db3.ConnectionString = "FileDSN=通用教材管理系统.dsn;UID=sa;PWD="
'db3.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=" & dabase1 & ";Data Source=" & SString
db3.Open '打开db3connection对象,使连接数据库
micount = 0 '设置mincount初值为0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -