?? frmlogin.frm
字號:
VERSION 5.00
Begin VB.Form frmLogin
BorderStyle = 1 'Fixed Single
Caption = "登錄系統(tǒng)"
ClientHeight = 2685
ClientLeft = 45
ClientTop = 330
ClientWidth = 4350
Icon = "frmLogin.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 2685
ScaleWidth = 4350
StartUpPosition = 2 '屏幕中心
Begin VB.Frame Frame1
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 1455
Left = 120
TabIndex = 4
ToolTipText = "歡迎使用成績管理系統(tǒng),請登錄系統(tǒng)"
Top = 480
Width = 4095
Begin VB.TextBox txtusername
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1560
TabIndex = 6
Top = 360
Width = 2175
End
Begin VB.TextBox txtpassword
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 5
Top = 840
Width = 2175
End
Begin VB.Label Label1
Caption = "用 戶 名:"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 400
TabIndex = 8
Top = 405
Width = 975
End
Begin VB.Label Label2
Caption = "密 碼:"
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 400
TabIndex = 7
Top = 885
Width = 975
End
End
Begin VB.CommandButton Command1
Caption = "登錄系統(tǒng)(&I)"
Height = 375
Left = 1560
TabIndex = 3
Top = 2160
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "退出系統(tǒng)(&E)"
Height = 375
Left = 3000
TabIndex = 2
Top = 2160
Width = 1215
End
Begin VB.CommandButton Command3
Caption = "注冊用戶(&N)"
Height = 375
Left = 120
TabIndex = 1
ToolTipText = "注冊要使用本系統(tǒng)的用戶"
Top = 2160
Width = 1215
End
Begin VB.Label Label3
Caption = " 學(xué) 籍 管 理 系 統(tǒng)"
BeginProperty Font
Name = "楷體_GB2312"
Size = 15
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 0
Top = 120
Width = 4095
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpbuffer As String, nSize As Long) As Long
Private Sub Command1_Click()
Dim txtSQL As String
Dim txtSQL1 As String
Dim sMeg As String
Dim MRC As ADODB.Recordset
Dim mrc1 As ADODB.Recordset
Dim MsgText As String
Dim Authority, IsValid As String
Dim OK As Boolean
UserName = ""
If Trim(txtusername.Text = "") Then
MsgBox "請輸入您的用戶名!", vbOKOnly + vbApplicationModal, "登錄系統(tǒng)"
txtusername.SetFocus
Else
txtSQL = "select * from userLogin where username = '" & txtusername.Text & "'and (SystemName='SYSTEM' or SystemName='Student')"
Set MRC = ExecuteSQL(txtSQL, MsgText)
If (MsgText = "查詢錯誤: [Microsoft][ODBC SQL Server Driver][SQL Server]無法打開登錄 'Exam' 中請求的數(shù)據(jù)庫。登錄失敗。") Then
MsgBox "系統(tǒng)無法運行,請建立運行本系統(tǒng)所需的數(shù)據(jù)庫!", vbOKOnly + vbCritical, "警告"
End
Exit Sub
End If
If MRC.EOF = True Then
MsgBox "沒有這個用戶,請重新輸入用戶名和密碼!", vbOKOnly + vbExclamation, "登錄系統(tǒng)"
txtusername.Text = ""
txtpassword.Text = ""
txtusername.SetFocus
Else
If Trim(MRC.Fields(2)) = Trim(txtpassword.Text) Then
OK = True
'---------------------------------對用戶的權(quán)限進行檢查------------------------------------
txtSQL1 = "select * from userLogin where username = '" & txtusername.Text & "'and (SystemName='SYSTEM' or SystemName='Student')"
Set mrc1 = ExecuteSQL(txtSQL1, MsgText)
Authority = Trim(MRC.Fields(3)) '獲得用戶的權(quán)限類別
IsValid = Trim(MRC.Fields(4))
If (IsValid = 0) Then
MsgBox "用戶名[" & frmLogin.txtusername.Text & "]正在使用,請使用您的用戶名!", vbOKOnly + vbCritical, "警告"
txtusername.Text = ""
txtpassword.Text = ""
Else
txtSQL = "update USERLOGIN set IsValid=0 where UserName='" & frmLogin.txtusername.Text & "'"
Set MRC = Module1.ExecuteSQL(txtSQL, MsgText)
If Authority = "A" Then
sMeg = "您的權(quán)限為:可以對學(xué)籍管理系統(tǒng)各功能模塊進行任何操作!"
MsgBox sMeg, vbOKOnly + vbInformation, "登錄成功"
Me.Hide
frmMain.Show
End If
If Authority = "B" Then
sMeg = "您的權(quán)限為:僅可以添加學(xué)生以及所在系和班級的信息,并對這些信息進行查詢!"
MsgBox sMeg, vbOKOnly + vbInformation, "登錄成功"
Me.Hide
frmMain.adm_teacher.Visible = False
frmMain.mod_dept.Visible = False
frmMain.mod_major.Visible = False
frmMain.mod_stu.Visible = False
frmMain.adm_user.Visible = False
frmMain.Show
End If
If Authority = "C" Then
sMeg = "您的權(quán)限為:僅可以添加教師信息以及所在系的信息,并對數(shù)據(jù)進行查詢!"
MsgBox sMeg, vbOKOnly + vbInformation, "登錄成功"
Me.Hide
frmMain.adm_stu.Visible = False
frmMain.mod_dept.Visible = False
frmMain.mod_major.Visible = False
frmMain.mod_teacher.Visible = False
frmMain.adm_user.Visible = False
frmMain.Show
End If
If Authority = "No Authority" Then
sMeg = "您是新注冊的用戶,尚未設(shè)定操作權(quán)限,請通知系統(tǒng)管理員分配您的操作權(quán)限!"
MsgBox sMeg, vbOKOnly + vbInformation, "登錄成功"
Call Module1.cnn_UPDATE
txtusername.Text = ""
txtpassword.Text = ""
End If
End If
'-----------------------------------------------------------------------------------------------
ElseIf txtpassword.Text = "" Then MsgBox "請輸入密碼!", vbOKOnly + vbApplicationModal, "登錄系統(tǒng)"
txtpassword.SetFocus
Else
MsgBox "輸入密碼不正確,請重新輸入!", vbOKOnly + vbExclamation, "登錄系統(tǒng)"
txtpassword.Text = ""
txtpassword.SetFocus
End If
End If
End If
End Sub
Private Sub Command2_Click()
Dim i As String
i = MsgBox("是否要退出學(xué)籍管理系統(tǒng)!", 4 + 256 + 64, "學(xué)籍管理系統(tǒng)")
If i = vbYes Then
End
End If
End Sub
Private Sub Command3_Click()
addUser.Show
Unload Me
End Sub
Private Sub Form_Load()
txtusername.Text = ""
End Sub
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -