📄 form1.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form register
BorderStyle = 3 'Fixed Dialog
Caption = "用户登录"
ClientHeight = 2370
ClientLeft = 3360
ClientTop = 2835
ClientWidth = 3915
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
NegotiateMenus = 0 'False
ScaleHeight = 158
ScaleMode = 3 'Pixel
ScaleWidth = 261
ShowInTaskbar = 0 'False
Begin VB.TextBox Text5
Appearance = 0 'Flat
BackColor = &H8000000B&
BorderStyle = 0 'None
DataField = "部门"
DataSource = "Adodc1"
Enabled = 0 'False
Height = 270
Left = 3120
TabIndex = 9
Top = 720
Width = 615
End
Begin VB.TextBox Text1
Height = 270
Left = 1080
TabIndex = 5
ToolTipText = "请输入法的用户名"
Top = 720
Width = 1305
End
Begin VB.CommandButton Command2
Caption = "退 出"
Height = 375
Left = 600
TabIndex = 4
Top = 1800
Width = 975
End
Begin VB.CommandButton Command1
Caption = "登 录"
Default = -1 'True
Height = 375
Left = 2280
TabIndex = 3
Top = 1800
Width = 975
End
Begin VB.TextBox Text2
BeginProperty DataFormat
Type = 0
Format = "******"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
Height = 270
IMEMode = 3 'DISABLE
Left = 1080
PasswordChar = "*"
TabIndex = 2
Top = 1080
Width = 1335
End
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = 960
Top = 1800
Visible = 0 'False
Width = 2055
_ExtentX = 3625
_ExtentY = 873
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=D:\zjssoft\zjsdata.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\zjssoft\zjsdata.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "admin"
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.TextBox Text6
Appearance = 0 'Flat
BackColor = &H80000013&
BorderStyle = 0 'None
DataField = "用户权限"
DataSource = "Adodc1"
Enabled = 0 'False
Height = 180
Left = 3120
TabIndex = 10
Top = 1200
Width = 615
End
Begin VB.Line Line1
X1 = 8
X2 = 272
Y1 = 112
Y2 = 112
End
Begin VB.Label Label11
Caption = "欢迎使用"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 840
TabIndex = 8
Top = 240
Width = 1455
End
Begin VB.Image Image1
Height = 480
Left = 240
MouseIcon = "Form1.frx":0000
Picture = "Form1.frx":1472
Top = 120
Width = 480
End
Begin VB.Label Label2
Caption = "密 码:"
Height = 255
Left = 240
TabIndex = 1
Top = 1080
Width = 735
End
Begin VB.Label Label1
Caption = "帐 号:"
Height = 255
Left = 240
TabIndex = 0
Top = 720
Width = 855
End
Begin VB.Label Label7
Caption = "部门:"
Enabled = 0 'False
Height = 255
Left = 2640
TabIndex = 6
Top = 720
Width = 615
End
Begin VB.Label Label9
Caption = "权限:"
Enabled = 0 'False
Height = 255
Left = 2640
TabIndex = 7
Top = 1200
Width = 735
End
End
Attribute VB_Name = "register"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim userName As String
Dim passwd As String
Dim ssql As String
Dim qx As String
Dim mmcount As Integer
ssql = "select * from admin where 用户id='" & Text1.Text & "'"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = ssql
Adodc1.Refresh
If Adodc1.Recordset.EOF = True Then
MsgBox "输入的帐号尚未注册,请重新输入!", vbOKOnly + vbExclamation, "输入错误"
Text1.Text = ""
Text2.Text = ""
Text1.SetFocus
Else
userid = Text1.Text
passwd = RTrim$(Adodc1.Recordset!用户密码)
qx = RTrim$(Adodc1.Recordset!用户权限)
If qx = "管理员" Then
qxpublic = Text6.Text
Else
qxpublic = Text6.Text
End If
If Text2.Text = passwd Then
Text1.Text = ""
Text2.Text = ""
mainsystem.Show
register.Hide
' Unload Me
qxpublic = Text6.Text
Else
MsgBox "password 错误", vbOKOnly + vbExclamation
Text2.Text = ""
Text2.SetFocus
End If
End If
End Sub
Private Sub Command3_Click()
Text3.DataField = "用户ID"
Text4.DataField = "用户身份"
Text5.DataField = "部门"
Text6.DataField = "权限"
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
'在主窗体的Form_load()中的最前面加入下列代码:
Dim X0 As Long
Dim Y0 As Long
'让窗体居中
X0 = Screen.Width
Y0 = Screen.Height
X0 = (X0 - Me.Width) / 2
Y0 = (Y0 - Me.Height) / 2
Me.Move X0, Y0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -