📄 frmdeviceedit.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form FrmDeviceEdit
Caption = "编辑设备信息"
ClientHeight = 3540
ClientLeft = 60
ClientTop = 345
ClientWidth = 6030
LinkTopic = "Form1"
ScaleHeight = 3540
ScaleWidth = 6030
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 2760
Top = 0
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 661
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 = ""
OLEDBString = ""
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 VB.CommandButton Cmd_Exit
Caption = "取 消"
Height = 375
Left = 3428
TabIndex = 11
Top = 3000
Width = 1215
End
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Height = 375
Left = 1388
TabIndex = 10
Top = 3000
Width = 1215
End
Begin MSAdodcLib.Adodc Adodc2
Height = 375
Left = 4680
Top = 0
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 661
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 = ""
OLEDBString = ""
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 VB.Frame Frame1
Height = 2655
Left = 120
TabIndex = 0
Top = 120
Width = 5775
Begin MSComCtl2.DTPicker dtStartDate
Height = 330
Left = 3960
TabIndex = 22
Top = 1623
Width = 1575
_ExtentX = 2778
_ExtentY = 582
_Version = 393216
Format = 24772609
CurrentDate = 38703
End
Begin VB.TextBox txtDevNo
Height = 330
Left = 1080
TabIndex = 17
Top = 240
Width = 1575
End
Begin MSDataListLib.DataCombo dco_TypeId
Height = 330
Left = 3960
TabIndex = 16
Top = 240
Width = 1575
_ExtentX = 2778
_ExtentY = 582
_Version = 393216
Text = ""
End
Begin VB.TextBox txtAdmin
Height = 330
Left = 1080
TabIndex = 14
Top = 2085
Width = 1575
End
Begin VB.TextBox txtPrice
Height = 330
Left = 1080
TabIndex = 13
Top = 1162
Width = 1575
End
Begin VB.TextBox txtPlace
Height = 330
Left = 3960
TabIndex = 8
Top = 1162
Width = 1575
End
Begin VB.TextBox txtModel
Height = 330
Left = 3960
TabIndex = 6
Top = 701
Width = 1575
End
Begin VB.TextBox txtPoster
Enabled = 0 'False
Height = 330
Left = 3960
TabIndex = 3
Top = 2085
Width = 1575
End
Begin MSDataListLib.DataCombo dco_Enterprise
Height = 330
Left = 1080
TabIndex = 19
Top = 701
Width = 1575
_ExtentX = 2778
_ExtentY = 582
_Version = 393216
Text = ""
End
Begin MSDataListLib.DataCombo dco_Branch
Height = 330
Left = 1080
TabIndex = 20
Top = 1623
Width = 1575
_ExtentX = 2778
_ExtentY = 582
_Version = 393216
Text = ""
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "所属支行"
Height = 180
Left = 240
TabIndex = 21
Top = 1698
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "设备编号"
Height = 180
Left = 240
TabIndex = 18
Top = 315
Width = 720
End
Begin VB.Label Label9
AutoSize = -1 'True
Caption = "创建人"
Height = 180
Left = 3120
TabIndex = 15
Top = 2160
Width = 540
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "购买价格"
Height = 180
Left = 240
TabIndex = 12
Top = 1237
Width = 720
End
Begin VB.Label Label8
AutoSize = -1 'True
Caption = "设备分类"
Height = 180
Left = 3120
TabIndex = 9
Top = 315
Width = 720
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "布放地点"
Height = 180
Left = 3120
TabIndex = 7
Top = 1237
Width = 720
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "设备型号"
Height = 180
Left = 3120
TabIndex = 5
Top = 776
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "设备品牌"
Height = 180
Left = 240
TabIndex = 4
Top = 776
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "管理员"
Height = 180
Left = 240
TabIndex = 2
Top = 2160
Width = 540
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "开通时间"
Height = 180
Left = 3120
TabIndex = 1
Top = 1698
Width = 720
End
End
Begin MSAdodcLib.Adodc Adodc3
Height = 375
Left = 0
Top = 0
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 661
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 = ""
OLEDBString = ""
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
End
Attribute VB_Name = "FrmDeviceEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean '插入=false,修改=true
Public OriId As String '设备编号
Private Sub Cmd_Exit_Click()
Unload Me
End Sub
Private Sub Cmd_OK_Click()
'检查用户录入数据的有效性
If Len(Trim(txtDevNo)) = 0 Then
MsgBox ("请输入设备编号")
txtDevNo.SetFocus
Exit Sub
End If
If Len(Trim(txtModel)) = 0 Then
MsgBox "请输入设备型号"
txtModel.SetFocus
Exit Sub
End If
If Len(Trim(dco_TypeId.Text)) = 0 Then
MsgBox "请选择设备分类"
dco_TypeId.SetFocus
Exit Sub
End If
If Len(Trim(dco_Enterprise.Text)) = 0 Then
MsgBox "请选择设备品牌"
dco_Enterprise.SetFocus
Exit Sub
End If
If Len(Trim(dco_Branch.Text)) = 0 Then
MsgBox "请选择所属支行"
dco_Branch.SetFocus
Exit Sub
End If
If Len(Trim(txtPrice)) = 0 Then
MsgBox "请输入设备单价"
txtPrice.SetFocus
Exit Sub
End If
If Len(Trim(txtPlace.Text)) = 0 Then
MsgBox "请选择布放地点"
txtPlace.SetFocus
Exit Sub
End If
'把用户录入的数据赋值到数据库对象变量中
With MyDevice
.DevNo = MakeStr(txtDevNo)
.TypeID = Val(dco_TypeId.BoundText)
.EnterpriseID = Val(dco_Enterprise.BoundText)
.Model = MakeStr(txtModel)
.Price = Val(txtPrice)
.Place = MakeStr(txtPlace)
.BranchID = Val(dco_Branch.BoundText)
.StartDate = Format(dtStartDate.Value, "yyyy-mm-dd")
.Administrator = MakeStr(txtAdmin)
.Poster = MakeStr(txtPoster)
.Status = "正常"
'根据变量Modify的值,决定是插入新数据,还是修改已有的数据
If Modify = False Then
'判断此设备编号是否存在
If .In_DB(Trim(txtDevNo)) = True Then
MsgBox ("已经存在此设备编号")
txtDevNo.SetFocus
Exit Sub
End If
.Insert
Else
.Update (OriId)
End If
End With
'关闭窗口
Unload Me
End Sub
Private Sub Form_Load()
DataRefresh
End Sub
Private Sub DataRefresh()
' 设备分类信息
Adodc1.ConnectionString = Conn '设置连接字符串
Adodc1.RecordSource = "SELECT * FROM BaseInfo WHERE TypeId=1" '选择设备分类
Adodc1.Refresh
Set dco_TypeId.RowSource = Adodc1 '绑定数据源
dco_TypeId.ListField = "InfoName" '显示列名
dco_TypeId.BoundColumn = "InfoId" '绑定列值
' 设备品牌信息
Adodc2.ConnectionString = Conn '设置连接字符串
Adodc2.RecordSource = "SELECT * FROM BaseInfo WHERE TypeId=2" '选择设备品牌
Adodc2.Refresh
Set dco_Enterprise.RowSource = Adodc2 '绑定数据源
dco_Enterprise.ListField = "InfoName" '显示列名
dco_Enterprise.BoundColumn = "InfoId" '绑定列值
' 支行信息
Adodc3.ConnectionString = Conn '设置连接字符串
Adodc3.RecordSource = "SELECT * FROM BaseInfo WHERE TypeId=3" '选择支行
Adodc3.Refresh
Set dco_Branch.RowSource = Adodc3 '绑定数据源
dco_Branch.ListField = "InfoName" '显示列名
dco_Branch.BoundColumn = "InfoId" '绑定列值
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -