📄 form12.frm
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
Begin VB.Form Form12
Caption = "登录界面"
ClientHeight = 5715
ClientLeft = 60
ClientTop = 510
ClientWidth = 9270
LinkTopic = "Form12"
ScaleHeight = 5715
ScaleWidth = 9270
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "退出系统"
Height = 495
Left = 5400
TabIndex = 9
Top = 3480
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "清空"
Height = 495
Left = 3240
TabIndex = 8
Top = 3480
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "登录"
Height = 495
Left = 1560
TabIndex = 7
Top = 3480
Width = 1335
End
Begin VB.Frame Frame1
Caption = "身份选择"
Height = 1455
Left = 5760
TabIndex = 4
Top = 360
Width = 2655
Begin VB.OptionButton Option2
Caption = "学生"
Height = 375
Left = 240
TabIndex = 6
Top = 840
Width = 2175
End
Begin VB.OptionButton Option1
Caption = "老师"
Height = 375
Left = 240
TabIndex = 5
Top = 360
Width = 2175
End
End
Begin VB.TextBox Text2
Height = 615
IMEMode = 3 'DISABLE
Left = 2520
PasswordChar = "*"
TabIndex = 3
Top = 1320
Width = 2655
End
Begin VB.TextBox Text1
Height = 615
Left = 2520
TabIndex = 2
Top = 360
Width = 2655
End
Begin ComctlLib.StatusBar StatusBar1
Align = 2 'Align Bottom
Height = 495
Left = 0
TabIndex = 10
Top = 5220
Width = 9270
_ExtentX = 16351
_ExtentY = 873
SimpleText = ""
_Version = 327682
BeginProperty Panels {0713E89E-850A-101B-AFC0-4210102A8DA7}
NumPanels = 3
BeginProperty Panel1 {0713E89F-850A-101B-AFC0-4210102A8DA7}
Object.Width = 4410
MinWidth = 4410
Text = "邮件自动处理系统欢迎您"
TextSave = "邮件自动处理系统欢迎您"
Object.Tag = ""
EndProperty
BeginProperty Panel2 {0713E89F-850A-101B-AFC0-4210102A8DA7}
Style = 6
Alignment = 2
AutoSize = 1
Object.Width = 8758
TextSave = "2006-6-13"
Object.Tag = ""
EndProperty
BeginProperty Panel3 {0713E89F-850A-101B-AFC0-4210102A8DA7}
Style = 5
Alignment = 2
TextSave = "11:12"
Object.Tag = ""
EndProperty
EndProperty
End
Begin VB.Label Label2
Caption = "请输入密码"
Height = 495
Left = 720
TabIndex = 1
Top = 1440
Width = 1575
End
Begin VB.Label Label1
Caption = "请输入用户名"
Height = 495
Left = 720
TabIndex = 0
Top = 480
Width = 1575
End
End
Attribute VB_Name = "Form12"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public db As New ADODB.Connection
Public rs As New ADODB.Recordset
Private Sub Command1_Click()
Dim mzy As String
Dim i As Integer
mzy = Text1.Text
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=(local);database=邮件系统;persist security info=false;user id=;"
db.Open
rs.Open "select * from 用户 where 用户名 ='" & mzy & "'", db, adOpenStatic, adLockReadOnly, -1
If rs.EOF Then
i = MsgBox("用户名错误!", 5 + vbExclamation, "输入用户名")
Text1.Text = ""
Else
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=(local);database=邮件系统;persist security info=false;user id=;"
db.Open
rs.Open "select * from 用户 where 用户名 ='" & Text1.Text & "' and 密码='" & Text2.Text & "'", db, adOpenStatic, adLockReadOnly, -1
If rs.EOF Then
i = MsgBox("用户密码错误!", 5 + vbExclamation, "输入用户密码")
Text2.Text = ""
ElseIf Option1.Value = True Then
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=(local);database=邮件系统;persist security info=false;user id=;"
db.Open
rs.Open "select * from 用户 where 用户名 ='" & Text1.Text & "' and 身份='" & Option1.Caption & "'", db, adOpenStatic, adLockReadOnly, -1
If rs.EOF Then
i = MsgBox("身份错误!", , "选择身份")
Else
Form12.Hide
frmMain.Show
End If
Else
Set db = New ADODB.Connection
Set rs = New ADODB.Recordset
db.ConnectionString = "driver={SQL Server};server=(local);database=邮件系统;persist security info=false;user id=;"
db.Open
rs.Open "select * from 用户 where 用户名 ='" & Text1.Text & "' and 身份='" & Option2.Caption & "'", db, adOpenStatic, adLockReadOnly, -1
If rs.EOF Then
i = MsgBox("身份错误!", , "选择身份")
Else
Form12.Hide
Form13.Show
End If
End If
End If
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
End Sub
Private Sub Command3_Click()
If MsgBox("您确定退出本系统吗?", vbExclamation + vbYesNo, "确认") = vbYes Then
End
End If
End Sub
Private Sub Form_Load()
Option2.Value = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -