📄 frm_lcsc.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form Frm_lcsc
BorderStyle = 1 'Fixed Single
Caption = "删除列车信息"
ClientHeight = 3045
ClientLeft = 45
ClientTop = 330
ClientWidth = 4470
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3045
ScaleWidth = 4470
StartUpPosition = 2 '屏幕中心
Begin MSAdodcLib.Adodc Adodc3
Height = 330
Left = 1920
Top = 4350
Width = 2295
_ExtentX = 4048
_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=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_dpgl;Data Source=."
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_dpgl;Data Source=."
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc3"
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 MSAdodcLib.Adodc Adodc2
Height = 330
Left = 810
Top = 3885
Width = 2130
_ExtentX = 3757
_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=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_dpgl;Data Source=."
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_dpgl;Data Source=."
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
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 MSAdodcLib.Adodc Adodc1
Height = 390
Left = 720
Top = 3240
Width = 2175
_ExtentX = 3836
_ExtentY = 688
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=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_dpgl;Data Source=."
OLEDBString = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=db_dpgl;Data Source=."
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 Command1
Caption = "退出"
Height = 375
Left = 2775
TabIndex = 2
Top = 2520
Width = 1050
End
Begin VB.Frame Frame2
Caption = "删除站点"
Height = 1230
Left = 135
TabIndex = 1
Top = 1200
Width = 4215
Begin VB.CommandButton Command3
Caption = "删除"
Height = 375
Left = 2625
TabIndex = 10
Top = 480
Width = 1050
End
Begin VB.ComboBox Combo3
Height = 300
Left = 1005
TabIndex = 7
Top = 765
Width = 1155
End
Begin VB.ComboBox Combo2
Height = 300
Left = 1020
TabIndex = 6
Top = 270
Width = 1155
End
Begin VB.Label Label3
Caption = "选择站点"
Height = 375
Left = 150
TabIndex = 9
Top = 795
Width = 780
End
Begin VB.Label Label2
Caption = "选择车次"
Height = 300
Left = 150
TabIndex = 8
Top = 315
Width = 825
End
End
Begin VB.Frame Frame1
Caption = "删除车次"
Height = 975
Left = 105
TabIndex = 0
Top = 120
Width = 4185
Begin VB.CommandButton Command2
Caption = "删除"
Height = 375
Left = 2625
TabIndex = 5
Top = 345
Width = 1050
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1035
TabIndex = 3
Top = 345
Width = 1200
End
Begin VB.Label Label1
Caption = "选择车次"
Height = 345
Left = 150
TabIndex = 4
Top = 405
Width = 915
End
End
End
Attribute VB_Name = "Frm_lcsc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo2_Click()
Dim s
Dim rs As New ADODB.Recordset
Combo3.Clear
rs.Open "select * from tb_cz where 车次='" & Combo2.Text & "'order by 车站代码", cnn, adOpenKeyset, adLockOptimistic
If rs.RecordCount > 0 Then
For i = 1 To rs.RecordCount
Combo3.AddItem rs.Fields("路过站").Value
rs.MoveNext
Next i
Combo3.RemoveItem (0)
s = Val("" & rs.RecordCount - 2 & "")
If s >= 0 Then Combo3.RemoveItem (s)
rs.Close
End If
End Sub
Private Sub Command1_Click()
Unload Me
Frm_lcsz.Show
End Sub
Private Sub Command2_Click()
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
If MsgBox("如果删除该次列车,其所有数据将全部删除,确认删除?", 4, "学生订票管理系统") = vbYes Then
Adodc1.RecordSource = "select * from tb_ccxx where 车次='" & Combo1.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.Delete
End If
Adodc2.RecordSource = "select * from tb_cz where 车次='" & Combo1.Text & "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
For i = 1 To Adodc2.Recordset.RecordCount
Adodc2.Recordset.Delete
Adodc2.Recordset.MoveNext
Next i
End If
MsgBox "车次删除成功!", , "学生订票管理系统"
If Combo1.ListIndex >= 0 Then Combo1.RemoveItem Combo1.ListIndex
End If
End Sub
Private Sub Command3_Click()
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Adodc3.RecordSource = "select * from tb_cz where 车次='" & Combo2.Text & "'and 路过站='" & Combo3.Text & "'"
Adodc3.Refresh
If Adodc3.Recordset.RecordCount > 0 Then
s = Adodc3.Recordset.Fields("车站代码")
On Error Resume Next
If MsgBox("确认删除该站点?", 4, "学生订票管理系统") = vbYes Then
Adodc3.Recordset.Delete
rs.Open "select * from tb_cz where 车次='" & Combo2.Text & "'and 车站代码 >= '" & s & "' order by 车站代码", cnn, adOpenKeyset, adLockOptimistic
rs.MoveFirst
For i = 1 To rs.RecordCount
rs.Fields("车站代码") = Format(Val(rs.Fields("车站代码")) - 1, "00")
rs.MoveNext
Next i
rs.Close
MsgBox "删除成功!", , "学生订票管理系统"
Combo3.Clear
End If
End If
End Sub
Private Sub Form_Load()
Dim s, m
s = "select 车次 from tb_ccxx "
m = "车次"
Call Frm_dpgl.add(Combo1, s, m)
s = "select 车次 from tb_ccxx "
m = "车次"
Call Frm_dpgl.add(Combo2, s, m)
Combo1.Text = "请选择"
Combo2.Text = Combo2.List(0)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -