📄 frmlogin.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmLogin
Caption = "用户登陆"
ClientHeight = 4095
ClientLeft = 60
ClientTop = 450
ClientWidth = 6180
LinkTopic = "Form2"
ScaleHeight = 4095
ScaleWidth = 6180
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 2280
Top = 3840
Visible = 0 'False
Width = 2055
_ExtentX = 3625
_ExtentY = 582
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
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=C:\Documents and Settings\ss\My Documents\book.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\ss\My Documents\book.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
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 Command2
Caption = "取消"
Height = 495
Left = 3120
TabIndex = 5
Top = 3000
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 960
TabIndex = 4
Top = 3000
Width = 1575
End
Begin VB.TextBox txtPassword
Height = 375
IMEMode = 3 'DISABLE
Left = 2640
PasswordChar = "*"
TabIndex = 3
Top = 2040
Width = 1815
End
Begin VB.TextBox txtUserName
Height = 375
Left = 2640
TabIndex = 2
Top = 1440
Width = 1815
End
Begin VB.Label Label3
Caption = "图书馆管理系统"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1560
TabIndex = 6
Top = 480
Width = 2415
End
Begin VB.Label Label2
Caption = "密 码"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1320
TabIndex = 1
Top = 2160
Width = 975
End
Begin VB.Label Label1
Caption = "用户名"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1320
TabIndex = 0
Top = 1560
Width = 975
End
End
Attribute VB_Name = "frmLogin"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim strUserName As String
Dim strPassword As String
Dim conn As ADODB.Connection
Dim rsLogin As ADODB.Recordset
Dim strSQL As String
If Trim(txtUserName.Text) = "" Then
MsgBox "“用户名”不能为空!"
Exit Sub
Else
strUserName = Trim(txtUserName.Text)
End If
If Trim(txtPassword.Text) = "" Then
MsgBox "“口令”不能为空!"
Exit Sub
Else
strPassword = Trim(txtPassword.Text)
End If
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=book.mdb;Persist Security Info=False"
conn.Open
strSQL = "select*from UserInfo where Username = '"
strSQL = strSQL + strUserName + "' and Password='" + strPassword + "'"
Set rsLogin = conn.Execute(strSQL)
If rsLogin.EOF Or rsLogin.BOF Then
MsgBox "用户名或口令错误,请检查!"
txtPassword.SelStart = 0
txtPassword.SelLength = Len(txtPassword.Text)
txtPassword.SetFocus
Else
Unload Me
If rsLogin.Fields(3).Value = "书籍操作员" Then
frmMain.Show
frmMain.MenuUserManager.Enabled = False
End If
If rsLogin.Fields(3).Value = "借阅操作员" Then
frmMain.Show
frmMain.MenuUserManager.Enabled = False
frmMain.MenuBookManager.Enabled = False
End If
If rsLogin.Fields(3).Value = "管理员" Then
frmMain.Show
End If
End If
Set rsLogin = Nothing
Set conn = Nothing
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -