📄 frm_edit_user.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Frm_edit_User
BackColor = &H008080FF&
Caption = "用户列表"
ClientHeight = 5265
ClientLeft = 60
ClientTop = 450
ClientWidth = 4860
LinkTopic = "Form1"
ScaleHeight = 5265
ScaleWidth = 4860
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Cmd_Modi
Caption = "修改密码"
Height = 375
Left = 480
TabIndex = 4
Top = 4200
Width = 975
End
Begin VB.CommandButton Cmd_Cancel
Caption = "取消"
Height = 375
Left = 3240
TabIndex = 3
Top = 4200
Width = 855
End
Begin VB.CommandButton Cmd_Del
Caption = "删除"
Height = 375
Left = 1920
TabIndex = 2
Top = 4200
Width = 855
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 1560
Top = 120
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_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= 3
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = "DSN=CarSaleSys"
OLEDBString = ""
OLEDBFile = ""
DataSourceName = "CarSaleSys"
OtherAttributes = ""
UserName = "sa"
Password = "sa"
RecordSource = "SELECT * FROM Users"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "Frm_edit_User.frx":0000
Height = 3255
Left = 240
TabIndex = 1
Top = 600
Width = 4215
_ExtentX = 7435
_ExtentY = 5741
_Version = 393216
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 3
BeginProperty Column00
DataField = "User_name"
Caption = "用户"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = "User_pwd"
Caption = "密码"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column02
DataField = "User_disc"
Caption = "类型"
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
ColumnWidth = 1200.189
EndProperty
BeginProperty Column01
ColumnWidth = 1335.118
EndProperty
BeginProperty Column02
ColumnWidth = 1874.835
EndProperty
EndProperty
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "选择列表"
Height = 255
Left = 360
TabIndex = 0
Top = 240
Width = 855
End
End
Attribute VB_Name = "Frm_edit_User"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Cmd_Cancel_Click()
Unload Me
End Sub
Private Sub Cmd_del_Click()
Dim username As String
If Adodc1.Recordset.EOF = True Then
MsgBox "请选择记录"
Exit Sub
End If
'通过Adodc1.Recordset.Fields()读取Adodc1记录源中的当前数据
username = Adodc1.Recordset.Fields(0)
'询问用户是否确认删除
If MsgBox("是否删除当前行?", vbYesNo, "确认") = vbYes Then
Adodc1.RecordSource = "Select * From Users Where User_name ='" + username + "'"
Adodc1.Refresh
Adodc1.Recordset.Delete
Adodc1.Recordset.Update
End If
'刷新DataGrid表格的内容
Adodc1.RecordSource = "SELECT u.User_name, u.User_Pwd, t.Type_discription As User_disc FROM Users u, UserType t Where t.User_type = u.User_type"
Adodc1.Refresh
End Sub
Private Sub Cmd_modi_Click()
If Adodc1.Recordset.EOF = True Then
MsgBox "请选择记录"
Exit Sub
End If
'通过Adodc1.Recordset.Fields()读取Adodc1记录源中的当前数据
Frm_modiUser.oldPwd = Adodc1.Recordset.Fields(1)
Frm_modiUser.username = Adodc1.Recordset.Fields(0)
Frm_modiUser.Show
End Sub
Private Sub Form_Load()
Dim i As Integer
Adodc1.RecordSource = "SELECT u.User_name, u.User_Pwd, t.Type_discription As User_disc FROM Users u, UserType t Where t.User_type = u.User_type"
Adodc1.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -