📄 form1.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form Form1
BackColor = &H00FFFFFF&
BorderStyle = 3 'Fixed Dialog
Caption = "登录系统"
ClientHeight = 2760
ClientLeft = 45
ClientTop = 435
ClientWidth = 4935
Icon = "Form1.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2760
ScaleWidth = 4935
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.CheckBox Check1
BackColor = &H00FFFFFF&
Caption = "Check1"
Height = 255
Left = 600
TabIndex = 7
Top = 2400
Value = 1 'Checked
Width = 255
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 1440
Top = 360
Visible = 0 'False
Width = 2145
_ExtentX = 3784
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
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 MSDataListLib.DataCombo DataCombo1
Bindings = "Form1.frx":0442
DataField = "用户名称"
DataSource = "Adodc1"
Height = 330
Left = 1230
TabIndex = 6
Top = 1170
Width = 1485
_ExtentX = 2619
_ExtentY = 582
_Version = 393216
Style = 2
ListField = "用户名称"
Text = ""
End
Begin VB.CommandButton Command3
Caption = "退出系统"
Height = 375
Left = 3210
TabIndex = 5
Top = 1920
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "注册新用户"
Height = 345
Left = 3210
TabIndex = 4
Top = 1500
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确 定"
Default = -1 'True
Height = 345
Left = 3210
Style = 1 'Graphical
TabIndex = 3
Top = 1080
UseMaskColor = -1 'True
Width = 1215
End
Begin VB.TextBox Text1
Height = 285
IMEMode = 3 'DISABLE
Left = 1260
PasswordChar = "*"
TabIndex = 0
Top = 1830
Width = 1395
End
Begin VB.Label Label3
BackColor = &H00FFFFFF&
Caption = "允许用户记忆密码"
Height = 255
Left = 960
TabIndex = 8
Top = 2400
Width = 1575
End
Begin VB.Label Label2
BackColor = &H00FFFFFF&
Caption = "密 码:"
Height = 315
Left = 420
TabIndex = 2
Top = 1860
Width = 765
End
Begin VB.Label Label1
BackColor = &H00FFFFFF&
Caption = "用户名:"
Height = 315
Left = 420
TabIndex = 1
Top = 1260
Width = 795
End
Begin VB.Image Image1
Height = 855
Left = 0
Picture = "Form1.frx":0457
Stretch = -1 'True
Top = 0
Width = 4965
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim sql As String
sql = "select * from yonghu where 用户名称='" & DataCombo1.Text & "'"
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Adodc1.Refresh
If Adodc1.Recordset.Fields(1) = Text1.Text Then
Adodc1.Recordset.Close
Unload Me
Form3.Show
Else
MsgBox "登录密码错误!请重新登录", vbOKOnly + vbExclamation, "警告"
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End If
End Sub
Private Sub Command2_Click()
Unload Me
Form2.Show
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub DataCombo1_Change()
Dim sql As String
sql = "select * from yonghu where 用户名称='" & DataCombo1.Text & "'"
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Adodc1.Refresh
If Check1.Value = 1 Then
Text1.Text = Adodc1.Recordset.Fields(1)
Else
Text1.Text = ""
End If
End Sub
Private Sub Form_Load()
Image1.Picture = LoadPicture(App.Path + "\tupian\beijing.jpg")
Form1.Icon = LoadPicture(App.Path + "\tupian\1.ico")
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc1.CommandType = adCmdTable
Adodc1.RecordSource = "yonghu"
Set DataCombo1.RowSource = Adodc1
DataCombo1.ListField = "用户名称"
Text1.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -