📄 form1.frm
字号:
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=D:\NiGeL_KaNg\market.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\NiGeL_KaNg\market.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "market"
Caption = "Adodc2"
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 MSDataGridLib.DataGrid DataGrid1
Bindings = "Form1.frx":003F
Height = 375
Left = 2640
TabIndex = 4
Top = 7800
Visible = 0 'False
Width = 2415
_ExtentX = 4260
_ExtentY = 661
_Version = 393216
AllowUpdate = 0 'False
DefColWidth = 53
HeadLines = 1
RowHeight = 15
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
Caption = "楼层"
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
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 495
Left = 240
Top = 8160
Visible = 0 'False
Width = 1200
_ExtentX = 2117
_ExtentY = 873
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 2
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=D:\NiGeL_KaNg\market.mdb;Persist Security Info=False"
OLEDBString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\NiGeL_KaNg\market.mdb;Persist Security Info=False"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "floor"
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 Command3
Caption = "修改"
Height = 735
Left = 240
TabIndex = 3
Top = 7200
Width = 1575
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 735
Left = 2760
TabIndex = 2
Top = 7200
Width = 1575
End
Begin VB.CommandButton Command1
Caption = "添加下一层"
Height = 735
Left = 240
Picture = "Form1.frx":0054
TabIndex = 1
Top = 6120
UseMaskColor = -1 'True
Width = 1575
End
Begin MSComctlLib.TreeView TreeView1
Height = 5295
Left = 240
TabIndex = 0
Top = 360
Width = 4335
_ExtentX = 7646
_ExtentY = 9340
_Version = 393217
LabelEdit = 1
LineStyle = 1
Style = 7
Appearance = 1
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
Dim nx As Node
Dim txt As String
Dim ct As Integer
Dim lcid As String
Dim lcm As String
Dim mktid As String
Dim mktm As String
Dim gzid As String
Dim gzm As String
Dim i As Integer
'-------------------------------------------------------------------------------------------------------
Dim cn As New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\market.mdb;"
'--------------------------------------------------------------------------------------------------------
Set nx = TreeView1.Nodes.Add(, , "scdl", "000000商场大楼")
'-------------------------------------------------------------
Adodc1.Refresh
DataGrid1.Refresh
ct = Adodc1.Recordset.RecordCount
If ct > 0 Then
Adodc1.Recordset.MoveFirst
For i = 1 To ct
lcid = Adodc1.Recordset.Fields("lc_id")
lcm = lcid + Adodc1.Recordset.Fields("lc")
Set nx = TreeView1.Nodes.Add("scdl", 4, lcid + "lc", lcm)
Adodc1.Recordset.MoveNext
Next i
End If
'---------------------------------------------------------------
ct = Adodc2.Recordset.RecordCount
If ct > 0 Then
Adodc1.Recordset.MoveFirst
For i = 1 To ct
mktid = Adodc2.Recordset.Fields("mkt_id")
mktm = Adodc2.Recordset.Fields("mkt")
txt = Adodc2.Recordset.Fields("lc_id") + "lc"
Set nx = TreeView1.Nodes.Add(txt, 4, mktid + "mkt", mktid + mktm + "商场")
Adodc2.Recordset.MoveNext
Next i
End If
'----------------------------------------------------------------
ct = Adodc3.Recordset.RecordCount
If ct > 0 Then
Adodc3.Recordset.MoveFirst
For i = 1 To ct
gzid = Adodc3.Recordset.Fields("gz_id")
gzm = Adodc3.Recordset.Fields("gz")
txt = Adodc3.Recordset.Fields("mkt_id") + "mkt"
Set nx = TreeView1.Nodes.Add(txt, 4, gzid + "gz", gzid + gzm)
Adodc3.Recordset.MoveNext
Next i
End If
If Adodc4.Recordset.Fields.Count = 1 Then
cn.Open
cn.Execute ("delete * from customer where customer")
cn.Close
Adodc4.Refresh
DataGrid4.Refresh
End If
'展开所有节点
For i = 1 To TreeView1.Nodes.Count - 1
TreeView1.Nodes(i).Expanded = True
Next i
End Sub
Private Sub Command2_Click()
Dim d As Integer
Dim i As Integer
Dim ct As Integer
Dim dm As String
Dim tmp As String
'-------------------------------------------------------------------------------------------------------
Dim cn As New ADODB.Connection
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\market.mdb;"
'--------------------------------------------------------------------------------------------------------
If TreeView1.SelectedItem.Key = "scdl" Then
MsgBox "程序规定必须保留商场大楼!"
ElseIf TreeView1.SelectedItem.Parent.Key = "scdl" Then
d = MsgBox("你确定要删除这个楼层吗?", vbOKCancel, "消息提示框")
If d = 1 Then
'-----------------------------------------------------------pppppppppppppp
If TreeView1.SelectedItem.Children > 0 Then '2当选中的节点有子节点时
'删除柜组
If Adodc3.Recordset.RecordCount > 0 Then '3 当柜组里面的内容不为空时
ct = Adodc3.Recordset.RecordCount
dm = Left(TreeView1.SelectedItem.Key, 6)
Adodc3.Recordset.MoveFirst
For i = 1 To ct
If Adodc3.Recordset.Fields("lc_id") = dm Then
'-----------------------------------------------------------------
'删除消费者信息
tmp = Adodc3.Recordset.Fields("gz_id")
cn.Open
cn.Execute ("alter table customer drop column " & tmp)
cn.Execute ("alter table customer drop column " & tmp + "tp")
cn.Close
Adodc4.Refresh
DataGrid4.Refresh
If Adodc4.Recordset.Fields.Count = 2 Then
cn.Open
cn.Execute ("delete * from customer where customer")
cn.Close
Adodc4.Refresh
DataGrid4.Refresh
Call tanpai
End If
'------------------------------------------------------------------
Adodc3.Recordset.Delete
Adodc3.Recordset.Update
End If
Adodc3.Recordset.MoveNext
Next i
End If '3
'删除商场
ct = Adodc2.Recordset.RecordCount
dm = Left(TreeView1.SelectedItem.Key, 6)
Adodc2.Recordset.MoveFirst
For i = 1 To ct
If Adodc2.Recordset.Fields("lc_id") = dm Then
Adodc2.Recordset.Delete
Adodc2.Recordset.Update
End If
Adodc2.Recordset.MoveNext
Next i
End If '2
'删除楼层
ct = Adodc1.Recordset.RecordCount
dm = Left(TreeView1.SelectedItem.Key, 6)
Adodc1.Recordset.MoveFirst
For i = 1 To ct
If Adodc1.Recordset.Fields("lc_id") = dm Then
Adodc1.Recordset.Delete
Adodc1.Recordset.Update
End If
Adodc1.Recordset.MoveNext
Next i
'------------------------------------------------------------ppppppppppppppppp
TreeView1.Nodes.Remove TreeView1.SelectedItem.Index
End If
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -