frmlogin.frm
来自「一个关于企业工资管理的数据库应用的例子。」· FRM 代码 · 共 212 行
FRM
212 行
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmlogin
BorderStyle = 1 'Fixed Single
Caption = "登录"
ClientHeight = 3240
ClientLeft = 45
ClientTop = 435
ClientWidth = 5325
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3240
ScaleWidth = 5325
StartUpPosition = 1 '所有者中心
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 1560
Top = 3960
Visible = 0 'False
Width = 2280
_ExtentX = 4022
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 2880
TabIndex = 7
Top = 2760
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "登陆"
Height = 375
Left = 1080
TabIndex = 6
Top = 2760
Width = 1335
End
Begin VB.PictureBox Picture1
Height = 1455
Left = 840
ScaleHeight = 1395
ScaleWidth = 4035
TabIndex = 1
Top = 1080
Width = 4095
Begin VB.TextBox Text1
Height = 375
Left = 1560
TabIndex = 3
Top = 120
Width = 1455
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 2
Top = 720
Width = 1455
End
Begin VB.Label Label2
Caption = "用户名:"
Height = 375
Left = 240
TabIndex = 5
Top = 120
Width = 975
End
Begin VB.Label Label3
Caption = "用户密码:"
Height = 375
Left = 240
TabIndex = 4
Top = 720
Width = 975
End
End
Begin VB.Label Label1
BackColor = &H00C0E0FF&
BorderStyle = 1 'Fixed Single
Caption = "欢迎进入企业工资管理系统"
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 495
Left = 600
TabIndex = 0
Top = 360
Width = 4455
End
End
Attribute VB_Name = "frmlogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
conn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
conn.Open
Dim rs1 As New ADODB.Recordset
rs.CursorLocation = adUseClient
rs1.CursorLocation = adUseClient
Dim sqlstr As String
Dim sqlstr1 As String
sqlstr = "select Adminid ,adminpass from admin where adminid='" & Trim(Text1.Text) & "'and adminpass='" & Trim(Text2.Text) & "'"
sqlstr1 = "select 员工编号,身份证号 from 员工档案表 where 员工编号='" & Trim(Text1.Text) & "'and 身份证号='" & Trim(Text2.Text) & "' "
rs.Open sqlstr, conn
rs1.Open sqlstr1, conn
Static maxlogintimes As Integer
maxlogintimes = 3
Static logintimes As Integer
logintimes = logintimes + 1
If logintimes = maxlogintimes Then
MsgBox "您已经三次输入错误信息,请退出!", vbCritical, "提示"
End
Else
If Trim(Text1.Text) = "" Or Trim(Text2.Text) = "" Then
MsgBox ("用户名和用户密码不能为空")
Else
If (rs1.RecordCount >= 1 Or rs.RecordCount >= 1) Then
If rs1.RecordCount >= 1 Then
MsgBox ("恭喜你,输入成功")
mainmdifrm.Show
frmlogin.Hide
logintimes = 0
Text1.Text = ""
Text2.Text = ""
mainmdifrm.tjyh.Enabled = False
mainmdifrm.bmgl.Enabled = False
mainmdifrm.tjyg.Enabled = False
mainmdifrm.tjyh.Enabled = False
mainmdifrm.gxyg.Enabled = False
mainmdifrm.scyg.Enabled = False
mainmdifrm.tjdd.Enabled = False
mainmdifrm.xgdd.Enabled = False
mainmdifrm.scdd.Enabled = False
Else
MsgBox ("恭喜你,输入成功")
mainmdifrm.Show
frmlogin.Hide
logintimes = 0
Text1.Text = ""
Text2.Text = ""
End If
Else
MsgBox ("您输入的用户密码有误!请重新输入!")
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End If
End If
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?