📄 frm_lcxg.frm
字号:
Height = 300
Left = 90
TabIndex = 21
Top = 255
Width = 690
End
Begin VB.Label Label2
Caption = "类 型"
Height = 240
Left = 2055
TabIndex = 20
Top = 270
Width = 705
End
Begin VB.Label Label3
Caption = "始发站"
Height = 255
Left = 90
TabIndex = 19
Top = 780
Width = 615
End
Begin VB.Label Label4
Caption = "始发时间"
Height = 255
Left = 1950
TabIndex = 18
Top = 780
Width = 765
End
Begin VB.Label Label7
Caption = "终点站"
Height = 240
Left = 3810
TabIndex = 17
Top = 780
Width = 615
End
Begin VB.Label Label8
Caption = "终到时间"
Height = 255
Left = 5700
TabIndex = 16
Top = 780
Width = 765
End
Begin VB.Label Label5
Caption = "硬座数量"
Height = 330
Left = 90
TabIndex = 15
Top = 1350
Width = 750
End
Begin VB.Label Label6
Caption = "软座数量"
Height = 315
Left = 1950
TabIndex = 14
Top = 1350
Width = 810
End
Begin VB.Label Label9
Caption = "硬卧数量"
Height = 240
Left = 3810
TabIndex = 13
Top = 1350
Width = 780
End
Begin VB.Label Label10
Caption = "软卧数量"
Height = 240
Left = 5700
TabIndex = 12
Top = 1350
Width = 780
End
End
Begin VB.CommandButton Command1
Caption = "退出"
Height = 375
Left = 6330
TabIndex = 0
Top = 3495
Width = 960
End
Begin VB.Label Label19
Caption = "Label19"
Height = 330
Left = 2340
TabIndex = 34
Top = 4020
Width = 1110
End
End
Attribute VB_Name = "Frm_lcxg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
Dim rs As New ADODB.Recordset
rs.Open "select * from tb_ccxx where 车次='" & Combo1.Text & "'", cnn, adOpenKeyset, adLockOptimistic
For i = 1 To 2
Text1(i).Text = rs.Fields(i)
Next i
DTP1.Value = rs.Fields(3)
Text1(3).Text = rs.Fields(4)
DTP2.Value = rs.Fields(5)
For i = 4 To 7
Text1(i).Text = rs.Fields(i + 2)
Next i
End Sub
Private Sub Combo2_Click()
Dim rs As New ADODB.Recordset
rs.Open "select * from tb_cz where 车次='" & Combo2.Text & "'", cnn, adOpenKeyset, adLockOptimistic
If rs.RecordCount > 0 Then
Combo3.Clear
s = "select * from tb_cz where 车次='" & Combo2.Text & "'"
m = "路过站"
Call Frm_dpgl.add(Combo3, s, m)
Combo3.Text = Combo3.List(0)
Else
MsgBox "该车次还没添加路过站", , "学生订票管理系统"
End If
Combo3.Text = "": Text2(2).Text = "": Text2(3).Text = ""
End Sub
Private Sub Combo3_Click()
Dim rs As New ADODB.Recordset
rs.Open "select * from tb_cz where 车次='" & Combo2.Text & "'and 路过站='" & Combo3.Text & "'", cnn, adOpenKeyset, adLockOptimistic
If rs.RecordCount > 0 Then
Text2(2).Text = rs.Fields("车站代码")
Text2(3).Text = rs.Fields("硬座价格")
If rs.Fields("到站时间") = "" Or rs.Fields("离站时间") = "" Then
DTP3.Value = "00:00:00": DTP4.Value = "00:00:00"
Else
DTP3.Value = rs.Fields("到站时间")
DTP4.Value = rs.Fields("离站时间")
End If
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
Dim rs2 As New ADODB.Recordset
For i = 1 To 3
If Text1(i).Text = "" Then
MsgBox "请输入完整信息", , "学生订票管理系统"
Exit Sub
End If
Next i
For i = 4 To 7
If IsNumeric(Text1(i).Text) = False Then
MsgBox "请输入正确数据", , "学生订票管理系统"
Exit Sub
End If
Next i
rs.Open "select * from tb_ccxx where 车次='" & Combo1.Text & "'", cnn, adOpenKeyset, adLockOptimistic
If rs.RecordCount > 0 Then
rs.Fields(0) = Combo1.Text
For i = 1 To 2
rs.Fields(i) = Text1(i).Text
Next i
rs.Fields(3) = Format(DTP1.Value, "hh:mm:ss")
rs.Fields(4) = Text1(3).Text
rs.Fields(5) = Format(DTP2.Value, "hh:mm:ss")
For i = 4 To 7
rs.Fields(i + 2) = Text1(i).Text
Next i
rs.Update
rs.Close
rs1.Open "select * from tb_cz where 车次='" & Combo1.Text & "'and 车站代码='01'", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
rs1.Fields("路过站") = Text1(2).Text
rs1.Update
End If
rs1.Close
rs2.Open "select * from tb_cz where 车次='" & Combo1.Text & "'order by 车站代码", cnn, adOpenKeyset, adLockOptimistic
If rs2.RecordCount > 0 Then
rs2.MoveLast
rs2.Fields("路过站") = Text1(3).Text
rs2.Update
End If
rs2.Close
MsgBox "车次修改成功!", , "学生订票管理系统"
End If
End Sub
Private Sub Command3_Click()
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
If IsNumeric(Text2(3).Text) = False Then
MsgBox "请输入正确的价格", , "学生订票管理系统"
Exit Sub
End If
rs1.Open "select * from tb_cz where 车次='" & Combo2.Text & "'", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
rs.Open "select * from tb_cz where 车次='" & Combo2.Text & "' and 路过站='" & Combo3.Text & " '", cnn, adOpenKeyset, adLockOptimistic
If rs.RecordCount > 0 Then
rs.Fields(3) = Format(DTP3.Value, "hh:mm:ss")
rs.Fields(4) = Format(DTP4.Value, "hh:mm:ss")
rs.Fields(5) = Text2(3).Text
rs.Update
rs.Close
MsgBox "站点修改完成", , "学生订票管理系统"
End If
Else
MsgBox "该车次还没添加路过站", , "学生订票管理系统"
End If
rs1.Close
Combo3.Text = "": Text2(2).Text = "": Text2(3).Text = ""
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 = Combo1.List(0)
Combo2.Text = Combo2.List(0)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -