📄 form7.frm
字号:
VERSION 5.00
Begin VB.Form form7
BackColor = &H80000004&
Caption = "登录"
ClientHeight = 2310
ClientLeft = 3555
ClientTop = 2940
ClientWidth = 3810
Icon = "Form7.frx":0000
LinkTopic = "Form7"
ScaleHeight = 2310
ScaleMode = 0 'User
ScaleWidth = 3810
Begin VB.Frame Frame1
Height = 135
Left = 0
TabIndex = 6
Top = 1560
Width = 4095
End
Begin VB.CommandButton 登录
Default = -1 'True
BeginProperty Font
Name = "宋体"
Size = 7.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 525
Left = 360
Picture = "Form7.frx":08CA
Style = 1 'Graphical
TabIndex = 5
Top = 1800
Width = 1095
End
Begin VB.ComboBox Combo1
DataField = "用户名"
DataSource = "Adodc1"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 360
ItemData = "Form7.frx":0D0C
Left = 2040
List = "Form7.frx":0D0E
TabIndex = 4
Top = 360
Width = 1335
End
Begin VB.CommandButton Command1
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2400
Picture = "Form7.frx":0D10
Style = 1 'Graphical
TabIndex = 3
Top = 1800
Width = 975
End
Begin VB.TextBox Text1
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 = 2040
PasswordChar = "*"
TabIndex = 0
Top = 1080
Width = 1335
End
Begin VB.Image Image1
Height = 480
Left = 240
Picture = "Form7.frx":21B8
Top = 360
Width = 480
End
Begin VB.Label Label2
Caption = "密码"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
TabIndex = 2
Top = 1080
Width = 735
End
Begin VB.Label Label1
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 960
TabIndex = 1
Top = 360
Width = 975
End
End
Attribute VB_Name = "form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
End
End Sub
Private Sub Form_Load()
Dim t As Integer
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=04;database=酒店管理;Persist Security Info=False;User ID=sa"
db.Open
rs.Open "select 用户名 from 密码表", db, adOpenStatic, adLockReadOnly
Dim i As String
For t = 0 To Val(rs.RecordCount) - 1
i = Trim(rs.Fields("用户名").Value)
rs.MoveNext
Combo1.AddItem i
Next t
rs.Close
'rs.Fields.Refresh 'rs.Close
End Sub
Private Sub 登录_Click()
If Combo1.Text <> "" Then
rs.Open "select 用户名,密码 from 密码表 where 用户名='" & Combo1.Text & "' and 密码='" & Text1.Text & "'"
If rs.EOF = True And rs.BOF = True Then
n = MsgBox(" 密码错误!请重试!", vbExclamation)
Text1.Text = ""
Text1.SetFocus
Else
form7.Hide
form1.Show
End If
rs.Close
Else
n = MsgBox(" 请选择用户名!", vbExclamation)
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -