📄 frmyhgl.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Form5
Caption = "用户管理"
ClientHeight = 3615
ClientLeft = 60
ClientTop = 450
ClientWidth = 5355
LinkTopic = "Form5"
ScaleHeight = 3615
ScaleWidth = 5355
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 360
Top = 1920
Width = 2775
_ExtentX = 4895
_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=grcw1.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=grcw1.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = ""
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 Command4
Caption = "关闭"
Height = 375
Left = 1800
TabIndex = 8
Top = 3120
Width = 1695
End
Begin VB.CommandButton Command3
Caption = "修改"
Height = 375
Left = 3720
TabIndex = 7
Top = 2520
Width = 1215
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 375
Left = 2040
TabIndex = 6
Top = 2520
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 375
Left = 360
TabIndex = 5
Top = 2520
Width = 1215
End
Begin VB.TextBox Text2
Height = 375
Left = 1320
TabIndex = 3
Top = 1200
Width = 1815
End
Begin VB.TextBox Text1
Height = 375
Left = 1320
TabIndex = 2
Top = 480
Width = 1815
End
Begin VB.Label Label3
BorderStyle = 1 'Fixed Single
Caption = "注意:用户名和密码不得超过10个中文字符或20个英文字母,密码最好用英文或数字。"
Height = 1575
Left = 3720
TabIndex = 4
Top = 360
Width = 1215
End
Begin VB.Label Label2
Caption = "密码:"
Height = 495
Left = 360
TabIndex = 1
Top = 1200
Width = 735
End
Begin VB.Label Label1
Caption = "用户名:"
Height = 375
Left = 360
TabIndex = 0
Top = 480
Width = 855
End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error GoTo AddErr
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "用户名和密码必须填写!"
Else
Adodc1.Recordset.AddNew
Command1.Enabled = False
Command3.Caption = "保存"
Adodc1.Refresh
End If
Exit Sub
AddErr:
MsgBox "数据添加失败!可能是数据库连接出错。"
End Sub
Private Sub Command2_Click()
On Error GoTo DeleteErr
With Adodc1.Recordset
.Delete
.MoveNext
.UpdateBatch
If .EOF Then .MoveLast
End With
Exit Sub
DeleteErr:
MsgBox "数据库已空或无法连接数据!"
End Sub
Private Sub Command3_Click()
On Error GoTo UpdateErr
Adodc1.Recordset.UpdateBatch
Command3.Caption = "修改"
Adodc1.Recordset.Fields("用户名") = Text1.Text
Adodc1.Recordset.Fields("密码") = Text2.Text
Exit Sub
UpdateErr:
MsgBox "数据无记录或数据库损坏!"
End Sub
Private Sub Command4_Click()
Unload Form5
End Sub
Private Sub Form_Load()
On Error GoTo err1
Command3.Caption = "修改"
With Adodc1
.RecordSource = "select * from yhb "
.Refresh
.Caption = "共有用户" & .Recordset.RecordCount & "个"
Set Text1.DataSource = Adodc1
Set Text2.DataSource = Adodc1
Text1.DataField = "用户名"
Text2.DataField = "密码"
End With
Exit Sub
err1:
MsgBox "数据库连接失败!"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -