?? e重新登錄.frm
字號:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form E重新登錄
Caption = "重新登錄"
ClientHeight = 3885
ClientLeft = 60
ClientTop = 450
ClientWidth = 4395
ForeColor = &H00000000&
LinkTopic = "Form1"
ScaleHeight = 3885
ScaleWidth = 4395
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox txtuser
Appearance = 0 'Flat
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
IMEMode = 3 'DISABLE
Left = 840
MaxLength = 6
TabIndex = 13
Top = 2040
Width = 1815
End
Begin VB.Frame Frame2
Height = 45
Left = -120
TabIndex = 10
Top = 480
Width = 4680
End
Begin VB.CommandButton cmdCancel
BackColor = &H00FFC0C0&
Caption = "退出&Q"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2160
MaskColor = &H00FFC0C0&
Style = 1 'Graphical
TabIndex = 9
Top = 3360
Width = 975
End
Begin VB.CommandButton CmdOk
BackColor = &H00FFC0C0&
Caption = "確定&O"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
MaskColor = &H00FFC0C0&
Style = 1 'Graphical
TabIndex = 8
Top = 3360
Width = 975
End
Begin VB.TextBox txtPassword
Appearance = 0 'Flat
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 375
IMEMode = 3 'DISABLE
Left = 840
MaxLength = 10
PasswordChar = "*"
TabIndex = 6
Top = 2640
Width = 1815
End
Begin VB.Frame Frame1
Caption = "用戶類型"
Height = 1335
Left = 0
TabIndex = 0
Top = 600
Width = 4335
Begin MSComctlLib.ListView ListView1
Height = 975
Left = 120
TabIndex = 1
Top = 240
Width = 4095
_ExtentX = 7223
_ExtentY = 1720
LabelWrap = -1 'True
HideSelection = -1 'True
_Version = 393217
Icons = "ImageList1"
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
NumItems = 0
End
End
Begin MSComctlLib.ImageList ImageList1
Left = 120
Top = 720
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 3
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "E重新登錄.frx":0000
Key = ""
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "E重新登錄.frx":08DC
Key = ""
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "E重新登錄.frx":11B8
Key = ""
EndProperty
EndProperty
End
Begin VB.Label Label4
Caption = "(6位)"
ForeColor = &H00C00000&
Height = 255
Index = 0
Left = 2760
TabIndex = 14
Top = 2160
Width = 495
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "用戶ID:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 255
Index = 3
Left = 60
TabIndex = 12
Top = 2160
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "用戶ID:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000006&
Height = 255
Index = 2
Left = 40
TabIndex = 11
Top = 2160
Width = 840
End
Begin VB.Label Label4
Caption = "(小于10位)"
ForeColor = &H00C00000&
Height = 255
Index = 1
Left = 2760
TabIndex = 7
Top = 2760
Width = 975
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "密碼:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000006&
Height = 255
Index = 1
Left = 255
TabIndex = 5
Top = 2760
Width = 735
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "密碼:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 255
Index = 0
Left = 240
TabIndex = 4
Top = 2760
Width = 735
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "網絡考試系統"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 390
Left = 1110
TabIndex = 3
Top = 120
Width = 2055
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "網絡考試系統"
BeginProperty Font
Name = "宋體"
Size = 15.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00C00000&
Height = 390
Left = 1140
TabIndex = 2
Top = 120
Width = 2055
End
End
Attribute VB_Name = "E重新登錄"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim SQL As String
Dim msg As String
Dim Index As Integer
Private Sub Form_Load()
'設置數據庫連接
Dim txtDatabase As String
Dim txtUserId As String
Dim txtPwd As String
Dim txtServer As String
txtDatabase = "網絡考試系統"
txtUserId = "sa"
txtPwd = "sa"
txtServer = "fanxinjian"
ConnectionString = "Provider=SQLOLEDB.1;Persist Security Info=True;"
ConnectionString = ConnectionString & "User ID=" & Trim(txtUserId) & ";Password=" & Trim(txtPwd) & ";"
ConnectionString = ConnectionString & "Initial Catalog=" & Trim(txtDatabase) & ";Data Source=" & Trim(txtServer)
'初始化用戶類型
Dim list As ListItem
Set list = ListView1.ListItems.Add(, , "考生", 3)
Set list = ListView1.ListItems.Add(, , "教師", 1)
Set list = ListView1.ListItems.Add(, , "工作人員", 2)
UserStyle = "考生" '默認用戶類型為考生
End Sub
Private Sub ListView1_Click()
'選擇用戶類型
UserStyle = ListView1.SelectedItem.Text '保存用戶類型
txtuser.Text = "000001" '默認的用戶ID,三種類型都一樣,為了方便測試和使用
End Sub
Private Sub CmdOK_Click()
'確定操作
Dim rst As ADODB.Recordset
Dim password As String '保存密碼
UserID = Trim(txtuser.Text)
password = Trim(txtPassword.Text)
If UserStyle = "考生" Then '如果用戶類型是考生
SQL = " select 考生號,密碼 from 考生信息表 where 考生號='" & UserID & "'"
ElseIf UserStyle = "教師" Then '如果用戶類型是教師
SQL = " select 教師ID,密碼 from 教師信息表 where 教師ID='" & UserID & "'"
ElseIf UserStyle = "工作人員" Then '如果用戶類型是工作人員
SQL = " select 管理人員ID,密碼 from 管理人員信息表 where 管理人員ID='" & UserID & "'"
End If
Set rst = SelectSQL(SQL, msg)
If rst.RecordCount > 0 Then '如果存在這個用戶
password = Trim(rst.Fields(1)) '取出該用戶的密碼
rst.Close
Else
MsgBox ("數據庫操作錯誤!")
Exit Sub
End If
'判斷密碼是否正確
If password = Trim(txtPassword.Text) Then
If UserStyle = "考生" Then '如果用戶類型是考生
B考生考試管理.Show
ElseIf UserStyle = "教師" Then '如果用戶類型是教師
A教師閱卷管理.Show
ElseIf UserStyle = "工作人員" Then '如果用戶類型是工作人員
工作人員管理.Show
End If
LoginSucceeded = True
Unload Me
Else
MsgBox ("密碼錯誤!")
txtPassword.SetFocus
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
LoginSucceeded = False
End If
End Sub
Private Sub cmdCancel_Click()
'設置全局變量為 false
'不提示失敗的登錄
LoginSucceeded = False
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
LoginSucceeded = False
Unload Me
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -