📄 main_xtsz_czysz.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 main_xtsz_czysz
Caption = "操作员设置"
ClientHeight = 3165
ClientLeft = 60
ClientTop = 345
ClientWidth = 5025
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 3165
ScaleWidth = 5025
WindowState = 2 'Maximized
Begin VB.Frame Frame2
Caption = "Frame2"
Height = 1095
Left = -1995
TabIndex = 6
Top = 705
Visible = 0 'False
Width = 2175
Begin MSAdodcLib.Adodc Adodc2
Height = 330
Left = 45
Top = 585
Width = 1905
_ExtentX = 3360
_ExtentY = 582
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=YYJXC;Initial Catalog=YYJXC"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=YYJXC;Initial Catalog=YYJXC"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from tb_power"
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
End
Begin VB.Frame Frame1
Height = 2115
Left = 60
TabIndex = 0
Top = 45
Width = 4875
Begin VB.TextBox txtczy
Height = 330
Left = 975
TabIndex = 8
Top = 225
Width = 3420
End
Begin VB.TextBox Text2
Height = 330
Left = 975
MaxLength = 6
TabIndex = 7
Top = 1050
Width = 3420
End
Begin VB.CommandButton Command3
Caption = "退出"
Height = 360
Left = 3195
TabIndex = 5
Top = 1560
Width = 1530
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 360
Left = 1650
TabIndex = 4
Top = 1560
Width = 1530
End
Begin VB.CommandButton Command1
Caption = "保存"
Height = 360
Left = 120
TabIndex = 3
Top = 1560
Width = 1530
End
Begin VB.TextBox Text1
Height = 330
Left = 975
TabIndex = 2
Top = 660
Width = 3420
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "操作员 编 号 密 码"
Height = 990
Left = 315
TabIndex = 1
Top = 375
Width = 630
End
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "main_xtsz_czysz.frx":0000
Height = 915
Left = 75
TabIndex = 9
Top = 2190
Width = 4860
_ExtentX = 8573
_ExtentY = 1614
_Version = 393216
AllowUpdate = 0 'False
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = "操作员编号"
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 = "操作员名称"
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 = 1620.284
EndProperty
BeginProperty Column01
ColumnWidth = 2085.166
EndProperty
EndProperty
End
End
Attribute VB_Name = "main_xtsz_czysz"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'定义数据集对象
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
Private Sub Form_Activate()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Command1_Click() '保存操作员信息
rs1.Open "select * from tb_power where 操作员名称='" & txtczy & "'", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
rs1.Fields("操作员名称") = txtczy
rs1.Fields("操作员编号") = Text1
rs1.Fields("密码") = Text2
'更新数据库
rs1.Update
Adodc2.Refresh
Else
If txtczy.Text <> "" Then
rs1.AddNew
rs1.Fields("操作员名称") = txtczy
rs1.Fields("操作员编号") = Text1
rs1.Fields("密码") = Text2
'更新数据库
rs1.Update
Adodc2.Refresh
End If
End If
rs1.Close
End Sub
Private Sub Command2_Click() '删除操作员信息
Dim a As String
If Adodc2.Recordset.RecordCount > 0 Then
a = MsgBox("您确实要删除这条数据吗?", vbYesNo)
If a = vbYes Then
Adodc2.Recordset.Delete
Adodc2.Refresh
End If
End If
End Sub
Private Sub Command3_Click()
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -