📄 form8.frm
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "comctl32.ocx"
Begin VB.Form Form8
BackColor = &H008080FF&
BorderStyle = 1 'Fixed Single
Caption = "登录"
ClientHeight = 9075
ClientLeft = 45
ClientTop = 435
ClientWidth = 13155
ForeColor = &H008080FF&
Icon = "Form8.frx":0000
LinkTopic = "Form8"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 9075
ScaleWidth = 13155
Begin VB.Timer Timer1
Interval = 100
Left = 9840
Top = 720
End
Begin ComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 615
Left = 0
TabIndex = 6
Top = 8460
Width = 13155
_ExtentX = 23204
_ExtentY = 1085
SimpleText = ""
_Version = 327682
BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7}
NumPanels = 3
BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7}
AutoSize = 1
Object.Width = 7708
MinWidth = 3528
Text = "欢迎登录图书管理系统"
TextSave = "欢迎登录图书管理系统"
Object.Tag = ""
EndProperty
BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7}
Style = 5
AutoSize = 1
Object.Width = 7708
MinWidth = 3528
TextSave = "12:11"
Object.Tag = ""
EndProperty
BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7}
Style = 6
AutoSize = 1
Object.Width = 7708
MinWidth = 3528
TextSave = "2007-7-8"
Object.Tag = ""
EndProperty
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "隶书"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.CommandButton Command2
BackColor = &H00FFFF00&
Caption = "取消"
BeginProperty Font
Name = "隶书"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 7320
Style = 1 'Graphical
TabIndex = 5
Top = 6600
Width = 1215
End
Begin VB.CommandButton Command1
BackColor = &H00FFFF00&
Caption = "确定"
BeginProperty Font
Name = "隶书"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 4080
Style = 1 'Graphical
TabIndex = 4
Top = 6600
Width = 1215
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "隶书"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
IMEMode = 3 'DISABLE
Left = 3480
PasswordChar = "*"
TabIndex = 3
Top = 4440
Width = 3975
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "隶书"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 3480
TabIndex = 2
Top = 2640
Width = 3975
End
Begin VB.Image Image1
Height = 3480
Left = 8520
Picture = "Form8.frx":058A
Stretch = -1 'True
Top = 2040
Width = 3120
End
Begin VB.Label Label3
BackColor = &H00C0C0C0&
BackStyle = 0 'Transparent
Caption = " 欢 迎 登 录"
BeginProperty Font
Name = "隶书"
Size = 42
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFF00&
Height = 855
Left = 840
TabIndex = 7
Top = 720
Width = 9855
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "密码"
BeginProperty Font
Name = "隶书"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 960
TabIndex = 1
Top = 4680
Width = 2055
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "用户名"
BeginProperty Font
Name = "隶书"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 960
TabIndex = 0
Top = 2640
Width = 2055
End
End
Attribute VB_Name = "Form8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim sql As String
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
If Text1 = "" Then ' 判断输入的用户名是否为空
MsgBox "用户名为空请重新输入", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Else
sql = "select * from 系统管理表 where 用户名='" & Text1.Text & "'"""
cn.Open "Driver={SQL Server};Server=.;Database=bookmdb;Uid=sa;Pwd=" '连接SQL数据库
rs.Open "系统管理表", cn, adOpenKeyset, adLockOptimistic
If rs.EOF = True Then
MsgBox "没有这个用户", vbOKOnly + vbExclamation, ""
Text1.SetFocus
Else
userID = Text1.Text
If Trim(rs.Fields(1)) = Trim(Text2.Text) Then
userID = Text1.Text
userpow = rs.Fields(2)
rs.Close
Unload Me
MDIForm1.Show
Else
MsgBox "密码不正确", vbOKOnly + vbExclamation, ""
Text2.SetFocus
End If
End If
End If
' 只能输入3次
cnt = cnt + 1
If cnt = 3 Then
Unload Me
End If
Exit Sub
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim ConnectionString As String
Dim cnt As Integer
ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=bookmdb;Data Source=."
conn.Open ConnectionString
cnt = 0
End Sub
Private Sub Timer1_Timer()
Static direction As Integer
If Label3.Left < 0 Then direction = 0
If Label3.Left + Label3.Width > Form8.Width Then
direction = 1
End If
If direction = 1 Then
Label3.Left = Label3.Left - 100
End If
If direction = 0 Then
Label3.Left = Label3.Left + 100
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -