📄 first.frm
字号:
VERSION 5.00
Begin VB.Form frmuser
Caption = "系统登陆"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdOK
Caption = "取消"
Height = 255
Index = 1
Left = 3960
TabIndex = 8
Top = 2760
Width = 615
End
Begin VB.CommandButton cmdOK
Caption = "确定"
Height = 255
Index = 0
Left = 3120
TabIndex = 7
Top = 2760
Width = 615
End
Begin VB.ComboBox txtUserName
Height = 300
Left = 1440
TabIndex = 6
Top = 960
Width = 1815
End
Begin VB.TextBox txtUserPass
Height = 270
IMEMode = 3 'DISABLE
Left = 1440
PasswordChar = "*"
TabIndex = 5
Top = 1320
Width = 1335
End
Begin VB.CheckBox Check1
Caption = "记住密码"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 3240
TabIndex = 1
Top = 1920
Width = 1095
End
Begin VB.Label checkPassWord
Caption = "密 码:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 4
Top = 1320
Width = 735
End
Begin VB.Label lable1
Caption = "用户名:"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 600
TabIndex = 3
Top = 960
Width = 735
End
Begin VB.Line Line2
X1 = 720
X2 = 3840
Y1 = 600
Y2 = 600
End
Begin VB.Label Label4
Caption = "学籍管理系统"
BeginProperty Font
Name = "宋体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1320
TabIndex = 2
Top = 240
Width = 2175
End
Begin VB.Line Line1
X1 = 3000
X2 = 4680
Y1 = 2640
Y2 = 2640
End
Begin VB.Label cmdNewUser
BackColor = &H80000013&
Caption = "新用户注册"
BeginProperty Font
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 0
TabIndex = 0
Top = 2760
Width = 975
End
End
Attribute VB_Name = "frmuser"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim miCount As Integer
Private conn As ADODB.Connection
Private rs As ADODB.Recordset
Private rsmc As ADODB.Recordset
Public UserName As String
Sub inputMain() '登陆系统模块
Dim txtsql As String
Dim MsgText As String
UserName = ""
If Trim(txtUserName.Text = "") Then
MsgBox "用户名称不能为空,请填入用户名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
txtsql = "Select * from xsADI where userName= '" & txtUserName.Text & "'"
Set rs = New ADODB.Recordset
rs.Open txtsql, conn, 2, 2
If Trim(rs.Fields(3)) = Trim(txtUserPass.Text) Then
If Check1.Value = 1 Then
rs.Fields(2).Value = 1
rs.Update
Else
rs.Fields(2).Value = 0
rs.Update
End If
rs.Close
Me.Hide
UserName = Trim(txtUserName.Text)
Load frmmain '装载主窗体
frmmain.Show '显示主窗体
Exit Sub
Else
MsgBox "输入密码错误,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtUserPass.SetFocus
txtUserPass.Text = ""
End If
End If
miCount = miCount + 1 '登陆次数的累加
If miCount = 5 Then
MsgBox "密码输入错误超过5次,您已无权进入系统,谢谢!", vbOKOnly + vbQuestion, "提示"
Unload Me
End
End If
Exit Sub
End Sub
Private Sub Form_Load()
Set conn = New ADODB.Connection
conn.ConnectionString = "DRIVER=SQL Server;UID=sa;DATABASE=xs;WSID=b86;APP=Microsoft Data Access Components;SERVER=b86" '链接数据库
On Error Resume Next
conn.Open
Set rsmc = New ADODB.Recordset
rsmc.CursorLocation = adUseClient
rsmc.Open "user_Info", conn, 1, 1 '打开数据表
'Set txtUserName= rsmc
'txtUserName.ListFields = "userName" '绑定字段
txtUserName.Text = "": txtUserPass.Text = "": txtUserName.SetFocus: txtUserName.Refresh
miCount = 0
End Sub
Private Sub cmdOK_Click(Index As Integer)
Select Case Index
Case 0 '确定
inputMain '调入系统登陆模块
Case 1 '退出
Unload Me
End
End Select
End Sub
Private Sub Form_Unload(Cancle As Integer)
conn.Close
Set rs = Nothing
End Sub
Private Sub cmdNewUser_Click() '新用户注册
Load frmNewUser
frmNewUser.Show (1) '显示新用户注册窗体
End Sub
Private Sub cmdNewUser_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
cmdNewUser.BorderStyle = 1
End Sub
Private Sub cmdNewUser_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
cmdNewUser.BorderStyle = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -