?? 登錄窗體.frm
字號:
VERSION 5.00
Begin VB.Form 登錄窗體
Caption = "采購管理系統-【登陸】"
ClientHeight = 3210
ClientLeft = 60
ClientTop = 450
ClientWidth = 4560
LinkTopic = "Form1"
Picture = "登錄窗體.frx":0000
ScaleHeight = 3210
ScaleWidth = 4560
StartUpPosition = 2 '屏幕中心
Begin VB.TextBox Text1
Height = 855
Left = 3840
TabIndex = 7
Top = 1920
Visible = 0 'False
Width = 495
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 330
Left = 2400
TabIndex = 3
Top = 2520
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "確定"
Default = -1 'True
Height = 330
Left = 960
TabIndex = 2
Top = 2520
Width = 1095
End
Begin VB.TextBox NowUser
Height = 330
Left = 1800
TabIndex = 1
Text = "admin"
Top = 1320
Width = 1695
End
Begin VB.TextBox NowPwd
Height = 330
IMEMode = 3 'DISABLE
Left = 1800
PasswordChar = "*"
TabIndex = 0
Text = "admin"
Top = 1815
Width = 1695
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "倉庫管理系統"
BeginProperty Font
Name = "宋體"
Size = 26.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H0000FFFF&
Height = 615
Left = 720
TabIndex = 6
Top = 360
Width = 3615
End
Begin VB.Label Label1
Alignment = 2 'Center
BackColor = &H8000000A&
BackStyle = 0 'Transparent
Caption = "用戶名:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 720
TabIndex = 5
Top = 1380
Width = 1215
End
Begin VB.Label Label2
Alignment = 2 'Center
BackColor = &H8000000A&
BackStyle = 0 'Transparent
Caption = "密 碼:"
BeginProperty Font
Name = "宋體"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 720
TabIndex = 4
Top = 1875
Width = 1215
End
End
Attribute VB_Name = "登錄窗體"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Command1_Click()
Dim CnnBool As Boolean
Dim Rst As New ADODB.Recordset
Dim strSQL As String
Dim rstCount As Integer
On Error GoTo ErrorExit
If NowUser.Text = "" Then
MsgBox "請輸入登錄者用戶名。", vbExclamation, Me.Caption
Me.NowUser.SetFocus
Exit Sub
End If
Screen.MousePointer = vbHourglass
CnnBool = ConnectDB
If CnnBool = False Then
Unload Me
Exit Sub
End If
strSQL = "SELECT * FROM 登錄 WHERE 用戶ID ='" & NowUser.Text & "'"
Rst.Open strSQL, cnnDatabase, adOpenDynamic, adLockReadOnly
rstCount = 0
Do While Rst.EOF = False
rstCount = rstCount + 1
Rst.MoveNext
Loop
If rstCount = 0 Then
MsgBox "無此用戶!"
cnnDatabase.Close
Screen.MousePointer = vbDefault
Me.NowUser.Text = ""
Me.NowPwd.Text = ""
Me.NowUser.SetFocus
Exit Sub
End If
If Rst.RecordCount > 1 Then
MsgBox "數據庫錯誤:用戶有重復!"
cnnDatabase.Close
Screen.MousePointer = vbDefault
Unload Me
Exit Sub
End If
Rst.MoveFirst
If IsNull(Rst.Fields("密碼").Value) Then
If NowPwd.Text <> "" Then
MsgBox "用戶密碼不正確!"
cnnDatabase.Close
Screen.MousePointer = vbDefault
Me.NowPwd.Text = ""
Me.NowPwd.SetFocus
Exit Sub
End If
Else
If NowPwd.Text <> Rst.Fields("密碼").Value Then
MsgBox "用戶密碼不正確!"
cnnDatabase.Close
Screen.MousePointer = vbDefault
Me.NowPwd.Text = ""
Me.NowPwd.SetFocus
Exit Sub
End If
End If
Me.Text1.Text = Rst.Fields("用戶名").Value
If Me.Text1.Text = "admin" Then
主窗體.Command10.Visible = True
Else
主窗體.Command10.Visible = False
End If
Screen.MousePointer = vbDefault
Set Rst = Nothing
Unload Me
主窗體.Show
Exit Sub
ErrorExit:
Screen.MousePointer = vbDefault
MsgBox Err.Description, vbInformation, Me.Caption
Set Rst = Nothing
Set cnnDatabase = Nothing
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -