📄 user1.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmuser1
BackColor = &H00FFFFC0&
BorderStyle = 1 'Fixed Single
Caption = "新增用户"
ClientHeight = 4425
ClientLeft = 45
ClientTop = 330
ClientWidth = 6510
LinkTopic = "Form2"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4425
ScaleWidth = 6510
Begin VB.Frame Frame1
BackColor = &H00FFFFC0&
Caption = "新增用户"
ForeColor = &H000000FF&
Height = 4215
Left = 120
TabIndex = 0
Top = 120
Width = 6255
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 4920
Top = 3720
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_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 = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = "he"
Password = "he"
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.TextBox Text1
Appearance = 0 'Flat
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 270
IMEMode = 3 'DISABLE
Index = 2
Left = 2400
PasswordChar = "*"
TabIndex = 10
TabStop = 0 'False
Top = 1320
Width = 855
End
Begin VB.Frame Frame3
BackColor = &H00FFFFC0&
Caption = "用户类别"
ForeColor = &H000000FF&
Height = 1815
Left = 480
TabIndex = 7
Top = 1680
Width = 5295
Begin VB.OptionButton optuser
BackColor = &H00FFFFC0&
Caption = "普通用户"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 495
Index = 2
Left = 1440
TabIndex = 9
Top = 1080
Width = 1815
End
Begin VB.OptionButton optmang
BackColor = &H00FFFFC0&
Caption = "管理员"
BeginProperty Font
Name = "楷体_GB2312"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 495
Index = 0
Left = 1440
TabIndex = 8
Top = 360
Width = 1815
End
End
Begin VB.CommandButton Command2
Caption = "返回"
Height = 375
Left = 3720
TabIndex = 6
Top = 3600
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 1200
TabIndex = 5
Top = 3600
Width = 1095
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 270
IMEMode = 3 'DISABLE
Index = 1
Left = 2400
PasswordChar = "*"
TabIndex = 3
TabStop = 0 'False
Top = 840
Width = 855
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 270
Index = 0
Left = 2400
TabIndex = 1
TabStop = 0 'False
Top = 360
Width = 855
End
Begin VB.Label Label3
BackColor = &H00FFFFC0&
Caption = "确定密码:"
ForeColor = &H00000000&
Height = 255
Left = 1440
TabIndex = 11
Top = 1320
Width = 975
End
Begin VB.Image Image1
Height = 480
Left = 3960
Picture = "user1.frx":0000
Top = 480
Width = 480
End
Begin VB.Label Label1
BackColor = &H00FFFFC0&
Caption = "密 码:"
ForeColor = &H00000000&
Height = 255
Left = 1440
TabIndex = 4
Top = 840
Width = 855
End
Begin VB.Label Label2
BackColor = &H00FFFFC0&
Caption = "新用户名:"
ForeColor = &H00000000&
Height = 255
Left = 1440
TabIndex = 2
Top = 390
Width = 975
End
End
End
Attribute VB_Name = "frmuser1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim sql As String
Private Sub Command1_Click()
If Trim(Text1(0).Text) = "" Then
MsgBox "用户名不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(0).SetFocus
Exit Sub
End If
If Trim(Text1(1).Text) = "" Then
MsgBox "密码不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(1).SetFocus
Exit Sub
End If
If Trim(Text1(2).Text) = "" Then
MsgBox "确认密码不能为空!", vbExclamation + vbOKOnly, "警告"
Text1(2).SetFocus
Exit Sub
End If
If Trim(Text1(1).Text) <> Trim(Text1(2).Text) Then
MsgBox "两次密码不一致!", vbExclamation + vbOKOnly, "警告"
Text1(2).Text = ""
Text1(2).SetFocus
Exit Sub
End If
If optmang(0).Value = False And optuser(2).Value = False Then
MsgBox "请选择权限!", vbExclamation + vbOKOnly, "警告"
Text1(2).SetFocus
Exit Sub
End If
Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
sql = "select * from use where username='" & Trim(Text1(0).Text) & "'"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Adodc1.Refresh
If Adodc1.Recordset.EOF = False Then
MsgBox " 该用户名已经存在!", vbExclamation + vbOKOnly, "警告"
Text1(0).SetFocus
Text1(0).SelStart = 0
Text1(0).SelLength = Len(Text1(0).Text)
Exit Sub
End If
Adodc1.Refresh
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields("username").Value = Trim(Text1(0).Text)
Adodc1.Recordset.Fields("password").Value = Trim(Text1(2).Text)
Adodc1.Recordset.Fields("ident").Value = ident
Adodc1.Recordset.Update
Adodc1.Refresh
MsgBox " 用户添加成功!", vbInformation + vbOKOnly, "警告"
Text1(0).Text = ""
Text1(1).Text = ""
Text1(2).Text = ""
optmang(0).Value = False
optuser(2).Value = False
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub optmang_Click(Index As Integer)
ident = "manager"
End Sub
Private Sub optuser_Click(Index As Integer)
ident = "user"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -