?? login_frm.frm
字號:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form login_frm
Caption = "登錄窗體"
ClientHeight = 3540
ClientLeft = 60
ClientTop = 345
ClientWidth = 5250
LinkTopic = "Form1"
Picture = "login_frm.frx":0000
ScaleHeight = 3540
ScaleWidth = 5250
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox txtusername
Height = 495
Left = 2280
TabIndex = 4
Top = 840
Width = 1215
End
Begin VB.TextBox txtpassword
Height = 495
IMEMode = 3 'DISABLE
Left = 2280
PasswordChar = "*"
TabIndex = 3
Top = 1680
Width = 1215
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 3960
Top = 3120
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\050531123賈晨微\db1.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\050531123賈晨微\db1.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "pwd"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton cmdexit
Caption = "退出"
Height = 495
Left = 3120
TabIndex = 2
Top = 2520
Width = 1095
End
Begin VB.CommandButton cmdok
Caption = "登錄"
Height = 495
Left = 840
TabIndex = 1
Top = 2520
Width = 1095
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "用戶名:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 840
TabIndex = 6
Top = 960
Width = 840
End
Begin VB.Label Label3
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "密碼:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 840
TabIndex = 5
Top = 1800
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "歡迎登錄學生選課系統"
BeginProperty Font
Name = "隸書"
Size = 18
Charset = 134
Weight = 400
Underline = 0 'False
Italic = -1 'True
Strikethrough = 0 'False
EndProperty
Height = 360
Left = 720
TabIndex = 0
Top = 240
Width = 3600
End
End
Attribute VB_Name = "login_frm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public OK As Boolean
Dim miCount As Integer
Dim con As ADODB.Connection
Private Sub Form_Load()
'創建連接
Set con = New ADODB.Connection
con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\050531123賈晨微\db1.mdb;Persist Security Info=False"
con.CursorLocation = adUseClient
con.Open
OK = False
miCount = 0
End Sub
Private Sub cmdexit_Click()
'退出
OK = False
Me.Hide
End Sub
Private Sub cmdok_Click()
'登錄
Dim rs As New ADODB.Recordset
Dim query As String
query = "select * from pwd where 用戶名 = '" & Trim(txtusername.Text) & "'"
rs.Open query, con, adOpenForwardOnly, adLockReadOnly
If Trim(rs.Fields("用戶名")) = Trim(txtusername.Text) Then
'檢驗用戶名
username = txtusername.Text
If Trim(rs.Fields("密碼")) = Trim(txtpassword.Text) Then
'檢驗密碼
If Trim(rs.Fields("權限")) = "學生" Then
'檢驗權限
Me.Hide
power = "學生"
mdiform1.Show
mdiform1.user.Enabled = True
mdiform1.zhuxiao.Enabled = True
mdiform1.student.Enabled = True
mdiform1.teacher.Enabled = False
mdiform1.course.Enabled = True
mdiform1.t_choice.Enabled = False
mdiform1.s_choice.Enabled = True
mdiform1.s_c_q.Enabled = True
mdiform1.t_c_q.Enabled = False
mdiform1.dayin.Enabled = True
Else
Me.Hide
power = "教師"
mdiform1.Show
mdiform1.user.Enabled = True
mdiform1.zhuxiao.Enabled = True
mdiform1.student.Enabled = False
mdiform1.teacher.Enabled = True
mdiform1.course.Enabled = True
mdiform1.t_choice.Enabled = True
mdiform1.s_choice.Enabled = False
mdiform1.s_c_q.Enabled = False
mdiform1.t_c_q.Enabled = True
mdiform1.dayin.Enabled = True
End If
Else
MsgBox "密碼錯誤!"
txtpassword.Text = ""
txtpassword.SetFocus
End If
Else
MsgBox "該用戶名不存在!"
End If
rs.Close
'判斷輸入錯誤密碼的次數,若達到3次,則自動退出登錄窗體
miCount = miCount + 1
If miCount = 3 Then
Me.Hide
End If
Exit Sub
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -