📄 frm_xtdl.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frm_xtdl
BorderStyle = 1 'Fixed Single
Caption = "系统登录"
ClientHeight = 2115
ClientLeft = 4245
ClientTop = 3435
ClientWidth = 3795
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2115
ScaleWidth = 3795
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
Caption = "操作员信息"
Height = 1410
Left = 120
TabIndex = 2
Top = 195
Width = 3525
Begin VB.TextBox Txt_Password
Appearance = 0 'Flat
BackColor = &H00FFFFFF&
Height = 285
IMEMode = 3 'DISABLE
Left = 1455
PasswordChar = "*"
TabIndex = 4
Top = 900
Width = 1875
End
Begin VB.ComboBox Op_Name
Height = 300
Left = 1455
TabIndex = 3
Top = 390
Width = 1875
End
Begin VB.Label Label2
Caption = "操作员口令:"
Height = 270
Left = 165
TabIndex = 6
Top = 960
Width = 1185
End
Begin VB.Label Label1
Caption = "操作员名称:"
Height = 270
Left = 165
TabIndex = 5
Top = 450
Width = 1185
End
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 300
Top = 4185
Width = 2175
_ExtentX = 3836
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton Cmd_Ok
Caption = "确定"
Height = 320
Left = 1785
TabIndex = 0
Top = 1665
Width = 875
End
Begin VB.CommandButton Cmd_Cancel
Caption = "取消"
Height = 320
Left = 2770
TabIndex = 1
Top = 1665
Width = 875
End
End
Attribute VB_Name = "frm_xtdl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim itmX As ListItem '定义一个ListItem对象
Dim key As String '定义字符串变量
Private Sub Cmd_Cancel_Click()
End
End Sub
'用户登录按钮的事件代码
Private Sub Cmd_Ok_Click()
Adodc1.RecordSource = "select * from 用户信息 where 用户名 ='" & Op_Name.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
MPassword = Adodc1.Recordset.Fields("密码")
If Txt_Password.Text = MPassword Then '判断数据的密码是否正确
Name1 = Op_Name.Text
Frm_Main.StatusBar1.Panels.Item(2).Text = "当前操作员: " + Adodc1.Recordset.Fields("用户名")
Frm_Main.Show '通过身份验证则显示主窗体,登录到系统当中
Unload Me
Else
MsgBox "密码不正确,请您确认后重新输入", , "提示信息"
Txt_Password.Text = ""
Txt_Password.SetFocus
End If
Else
MsgBox "对不起 没有此用户的信息", , "提示信息"
Op_Name.Text = ""
Txt_Password.Text = ""
End If
End Sub
Private Sub Form_Load()
'使用代码连接数据库与数据表
Adodc1.ConnectionString = MyStrs
Adodc1.RecordSource = "select * from 用户信息"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
Op_Name.Clear '在添加数据时,首先清空控件中的内容
Do While Adodc1.Recordset.EOF = False '将操作员信息添加到下拉列表框控件当中
Op_Name.AddItem (Adodc1.Recordset.Fields("用户名"))
Adodc1.Recordset.MoveNext
Loop
End If
End Sub
Private Sub Label3_Click()
End Sub
Private Sub Txt_Password_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Call Cmd_Ok_Click '调用确定按钮的单击事件代码
End If
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Txt_Password.SetFocus
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -