📄 用户管理.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form Form11
BackColor = &H00808080&
Caption = "用户管理"
ClientHeight = 2670
ClientLeft = 60
ClientTop = 420
ClientWidth = 6300
LinkTopic = "Form11"
ScaleHeight = 2670
ScaleWidth = 6300
StartUpPosition = 3 '窗口缺省
Begin MSAdodcLib.Adodc Adodc1
Height = 735
Left = 6840
Top = 960
Width = 1815
_ExtentX = 3201
_ExtentY = 1296
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=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=canku"
OLEDBString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=canku"
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 MSHierarchicalFlexGridLib.MSHFlexGrid MSHFlexGrid1
Bindings = "用户管理.frx":0000
Height = 2655
Left = 0
TabIndex = 13
Top = 2880
Width = 7695
_ExtentX = 13573
_ExtentY = 4683
_Version = 393216
_NumberOfBands = 1
_Band(0).Cols = 2
End
Begin VB.CommandButton Command3
BackColor = &H00808080&
Caption = "取消"
Height = 350
Left = 5040
Style = 1 'Graphical
TabIndex = 12
Top = 2280
Width = 975
End
Begin VB.CommandButton Command1
BackColor = &H00808080&
Caption = "确定"
Height = 350
Left = 3840
Style = 1 'Graphical
TabIndex = 11
Top = 2280
Width = 975
End
Begin VB.Frame Frame2
BackColor = &H00808080&
Height = 1335
Left = 0
TabIndex = 3
Top = 840
Width = 6255
Begin VB.ComboBox Combo1
Height = 300
ItemData = "用户管理.frx":0015
Left = 4560
List = "用户管理.frx":001F
TabIndex = 14
Text = "管理员"
Top = 240
Width = 1335
End
Begin VB.TextBox Text4
Height = 375
IMEMode = 3 'DISABLE
Left = 4560
PasswordChar = "*"
TabIndex = 10
Top = 840
Width = 1335
End
Begin VB.TextBox Text2
Height = 375
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 7
Top = 840
Width = 1215
End
Begin VB.TextBox Text1
Height = 375
Left = 1560
TabIndex = 5
Top = 240
Width = 1215
End
Begin VB.Label Label4
BackColor = &H00808080&
Caption = "确认密码"
Height = 255
Left = 3360
TabIndex = 9
Top = 960
Width = 975
End
Begin VB.Label Label3
BackColor = &H00808080&
Caption = "权限"
Height = 375
Left = 3360
TabIndex = 8
Top = 360
Width = 1095
End
Begin VB.Label Label2
BackColor = &H00808080&
Caption = "用户密码"
Height = 255
Left = 240
TabIndex = 6
Top = 960
Width = 1215
End
Begin VB.Label Label1
BackColor = &H00808080&
Caption = "用户名称"
Height = 375
Left = 240
TabIndex = 4
Top = 360
Width = 1215
End
End
Begin VB.Frame Frame1
BackColor = &H00808080&
Caption = "操作选择"
Height = 855
Left = 0
TabIndex = 0
Top = 0
Width = 6255
Begin VB.OptionButton Option2
BackColor = &H00808080&
Caption = "删除现有用户"
Height = 255
Left = 3600
TabIndex = 2
Top = 360
Width = 1695
End
Begin VB.OptionButton Option1
BackColor = &H00808080&
Caption = "注册新用户"
Height = 255
Left = 960
TabIndex = 1
Top = 360
Width = 1695
End
End
End
Attribute VB_Name = "Form11"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim name As String
Dim password As String
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=SQLOLEDB.1;password=huangtao;User ID=huangtao;Initial Catalog=canku"
conn.Open
Set rs1 = New ADODB.Recordset
name = Trim(Text1.Text)
password = Trim(Text2.Text)
'-----------------------注册新用户---------------------------------------------
If Me.Option1.Value = True Then
If Text1.Text = "" Or Text2.Text = "" Or Combo1.Text = "" Or Text4.Text = "" Then
MsgBox "请填入完整信息!", , "库存管理系统"
Else
sql = "select * from 用户信息 where 用户名='" & name & "'"
rs1.Open sql, conn, 1, 3
If rs1.BOF = False And rs1.EOF = False Then
MsgBox "该用户已存在!请重新输入!", , "库存管理系统"
Text1.Text = ""
Else
If Text4.Text <> Text2.Text Then
MsgBox "两次输入的密码不一致!请重新输入!", , "库存管理系统"
Text4.Text = ""
Else
Set user = New ADODB.Recordset
Set conn = New ADODB.Connection
conn.ConnectionString = "Provider=SQLOLEDB.1;password=huangtao;User ID=huangtao;Initial Catalog=canku"
conn.Open
sql = "select * from 用户信息"
user.CursorLocation = adUseClient
user.Open sql, conn, 1, 3
user.AddNew
user.Fields(0).Value = name
user.Fields(1).Value = password
user.Fields(2).Value = Combo1.Text
user.update
Form18.DataGrid1.Refresh
MsgBox "注册成功!!哈哈哈!!!!!!!!!!!!!", , "库存管理系统"
End If
End If
End If
End If
'-----------------------删除现有用户-----------------------------------------------
If Me.Option2.Value = True Then
If Text4.Text <> Text2.Text Then
MsgBox "两次输入的密码不一致!请重新输入!", , "库存管理系统"
Text4.Text = ""
End If
sql = "select * from 用户信息 where 用户名='" & name & "'"
Set rs2 = New ADODB.Recordset
rs2.Open sql, conn, 1, 3
If rs2.BOF = True And rs2.EOF = True Then
MsgBox "没有此用户!请重新输入!", , "库存管理系统"
Text1.Text = ""
Text2.Text = ""
Combo1.Text = ""
Text4.Text = ""
Else
If password <> rs2.Fields(1).Value Then
MsgBox "输入密码错误!请重新输入!", , "库存管理系统"
Text2.Text = ""
End If
If Text4.Text <> Text2.Text Then
MsgBox "两次输入的密码不一致!请重新输入!", , "库存管理系统"
Text4.Text = ""
Else
rs2.Delete
MsgBox "删除成功!", , "库存管理系统"
Form18.DataGrid1.Refresh
End If
End If
End If
End Sub
Private Sub Command3_Click()
Form11.Hide
End Sub
Private Sub Form_Load()
Set Me.MSHFlexGrid1.DataSource = Adodc1.Recordset
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -