📄 frm_yhgl.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frm_YHGL
BorderStyle = 3 'Fixed Dialog
Caption = "用户管理"
ClientHeight = 2550
ClientLeft = 3645
ClientTop = 2925
ClientWidth = 4320
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2550
ScaleWidth = 4320
ShowInTaskbar = 0 'False
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 120
Top = 2880
Visible = 0 'False
Width = 2175
_ExtentX = 3836
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=ljm"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=ljm"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from Table_YHDL"
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.Frame Frame3
Caption = "操作选择"
Height = 735
Left = 0
TabIndex = 15
Top = 0
Width = 4335
Begin VB.OptionButton Option1
Caption = "注册新用户"
Height = 375
Left = 600
TabIndex = 17
Top = 240
Width = 1455
End
Begin VB.OptionButton Option2
Caption = "删除现有的用户"
Height = 375
Left = 2280
TabIndex = 16
Top = 240
Width = 1815
End
End
Begin VB.TextBox Text6
Height = 375
Left = 240
TabIndex = 13
Text = "111"
Top = 5280
Visible = 0 'False
Width = 975
End
Begin VB.CommandButton Command3
Caption = "取消"
Height = 375
Left = 3480
TabIndex = 12
Top = 2160
Width = 855
End
Begin VB.CommandButton Command2
Caption = "确定"
Height = 375
Left = 2520
TabIndex = 11
Top = 2160
Width = 855
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 2520
TabIndex = 10
Top = 2160
Width = 855
End
Begin VB.Frame Frame2
Height = 1335
Left = 0
TabIndex = 1
Top = 720
Width = 4335
Begin VB.TextBox Text3
Height = 300
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 7
Top = 920
Width = 2535
End
Begin VB.TextBox Text2
Height = 300
IMEMode = 3 'DISABLE
Left = 1560
PasswordChar = "*"
TabIndex = 6
Top = 550
Width = 2535
End
Begin VB.TextBox Text1
Height = 300
Left = 1560
TabIndex = 5
Top = 200
Width = 2535
End
Begin VB.Label Label3
Caption = "确认密码"
Height = 225
Left = 240
TabIndex = 4
Top = 980
Width = 1215
End
Begin VB.Label Label2
Caption = "用户密码"
Height = 375
Left = 240
TabIndex = 3
Top = 650
Width = 1215
End
Begin VB.Label Label1
Caption = "用户名称"
Height = 375
Left = 240
TabIndex = 2
Top = 300
Width = 1335
End
End
Begin VB.Frame Frame1
Height = 1335
Left = 0
TabIndex = 0
Top = 720
Width = 4335
Begin VB.CommandButton Command4
Caption = "<<"
Height = 310
Left = 2880
TabIndex = 14
Top = 720
Width = 375
End
Begin VB.TextBox Text4
Height = 300
Left = 1080
TabIndex = 9
Top = 720
Width = 1815
End
Begin VB.Label Label4
Caption = "请选择您要删除的用户名称"
Height = 255
Left = 1080
TabIndex = 8
Top = 360
Width = 2175
End
End
End
Attribute VB_Name = "frm_YHGL"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a
Public adoCon As New ADODB.Connection
Public adoRs As New ADODB.Recordset
Private Sub Command1_Click()
Set adoCon = New ADODB.Connection
adoCon.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=ljm"
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
MsgBox "输入不完全!!", , "房地产销售管理系统"
Else
If Text2.Text = Text3.Text Then
Set adoRs = adoCon.Execute("insert into Table_YHDL values(" & Text6 & ",'" & Text1 & "','" & Text2 & "')")
MsgBox "注册成功!!", 48, "房地产销售管理系统"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
frm_YHGL.Hide
Else
MsgBox "两次输入的密码不一致,请您确认后重新输入", 48, "房地产销售管理系统"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
End If
End If
adoCon.Close
End Sub
Private Sub Command2_Click()
a = MsgBox("您确认要删除该用户吗?", 17, "房地产销售管理系统")
If a = vbOK Then
Adodc1.RecordSource = "select * from Table_YHDL where 用户名='" + Text4.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Delete
MsgBox "用户信息删除成功", 32, "房地产销售管理系统"
Text4.Text = ""
frm_YHGL.Hide
Else
MsgBox "没有该用户的信息,请您确认后重新输入", 32, "房地产销售管理系统"
Text4.SetFocus
End If
Else
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
Private Sub Command4_Click()
frm_RYXS.Show
frm_RYXS.Caption = "用户删除"
End Sub
Private Sub Form_Activate()
If Option1.Value = 1 Then
Frame2.Visible = True
Frame1.Visible = False
Command1.Visible = True
Command2.Visible = False
ElseIf Option2.Value = 1 Then
Frame1.Visible = True
Frame2.Visible = False
Command2.Visible = True
Command1.Visible = False
Else
End If
End Sub
Private Sub Option1_Click()
Frame2.Visible = True
Frame1.Visible = False
Command1.Visible = True
Command2.Visible = False
Text1.SetFocus
End Sub
Private Sub Option2_Click()
Frame1.Visible = True
Frame2.Visible = False
Command2.Visible = True
Command1.Visible = False
Text4.SetFocus
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text2.SetFocus
Else
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Text3.SetFocus
Else
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
Set adoCon = New ADODB.Connection
adoCon.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=ljm"
If KeyCode = 13 Then
If Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Then
MsgBox "输入不完全!!", , "房地产销售管理系统"
Else
If Text2.Text = Text3.Text Then
Set adoRs = adoCon.Execute("insert into Table_YHDL values(" & Text6 & ",'" & Text1 & "','" & Text2 & "')")
MsgBox "注册成功!!", 48, "房地产销售管理系统"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
frm_YHGL.Hide
Else
MsgBox "两次输入的密码不一致,请您确认后重新输入", 48, "房地产销售管理系统"
Text2.Text = ""
Text3.Text = ""
Text2.SetFocus
End If
End If
Else
End If
adoCon.Close
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
a = MsgBox("您确认要删除该用户吗?", 17, "房地产销售管理系统")
If a = vbOK Then
Adodc1.RecordSource = "select * from Table_YHDL where 用户名='" + Text4.Text + "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Delete
frm_YHGL.Hide
Else
MsgBox "没有该用户的信息,请您确认后重新输入", 32, "房地产销售管理系统"
Text4.SetFocus
End If
Else
End If
Else
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -