📄 frm_lcdj.frm
字号:
CurrentDate = 39446
End
Begin VB.CommandButton Command3
Caption = "录入"
Height = 375
Left = 6345
TabIndex = 30
Top = 870
Width = 960
End
Begin VB.TextBox Text2
Height = 345
Index = 3
Left = 4860
TabIndex = 18
Top = 900
Width = 1050
End
Begin VB.TextBox Text2
Height = 345
Index = 2
Left = 4860
TabIndex = 17
Top = 285
Width = 1050
End
Begin VB.TextBox Text2
Height = 345
Index = 1
Left = 2805
TabIndex = 16
Top = 240
Width = 1050
End
Begin VB.Label Label16
Caption = "硬座价格"
Height = 225
Left = 3945
TabIndex = 29
Top = 990
Width = 810
End
Begin VB.Label Label15
Caption = "离站时间"
Height = 270
Left = 2010
TabIndex = 28
Top = 945
Width = 750
End
Begin VB.Label Label14
Caption = "到站时间"
Height = 270
Left = 60
TabIndex = 27
Top = 975
Width = 840
End
Begin VB.Label Label13
Caption = "车站代码"
Height = 210
Left = 3945
TabIndex = 26
Top = 360
Width = 795
End
Begin VB.Label Label12
Caption = "站 点"
Height = 270
Left = 2010
TabIndex = 14
Top = 270
Width = 735
End
Begin VB.Label Label11
Caption = "车 次"
Height = 345
Left = 60
TabIndex = 13
Top = 270
Width = 600
End
End
Begin VB.Label Label19
Caption = "Label19"
Height = 330
Left = 2325
TabIndex = 36
Top = 4050
Width = 1110
End
End
Attribute VB_Name = "Frm_lcdj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim s, m
Private Sub Combo1_Click()
Call code
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
For i = 0 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 车次='" & Text1(0).Text & "'", cnn, adOpenKeyset, adLockOptimistic
If rs.RecordCount > 0 Then
MsgBox "该车次已存在", , "学生订票管理系统"
rs.Close
Exit Sub
End If
rs1.Open "select * from tb_ccxx", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then rs1.MoveLast
rs1.AddNew
For i = 0 To 2
rs1.Fields(i) = Text1(i).Text
Next i
rs1.Fields(3) = Format(DTP1.Value, "hh:mm:ss")
rs1.Fields(4) = Text1(3).Text
rs1.Fields(5) = Format(DTP2.Value, "hh:mm:ss")
For i = 4 To 7
rs1.Fields(i + 2) = Text1(i).Text
Next i
rs1.Update
rs1.Close
rs.Close
MsgBox "车次添加成功!", , "学生订票管理系统"
s = "select 车次 from tb_ccxx "
m = "车次"
Combo1.Clear
Call Frm_dpgl.add(Combo1, s, m)
Combo1.Text = Combo1.List(0)
End Sub
Private Sub Command3_Click()
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Dim rs2 As New ADODB.Recordset
rs.Open "select * from tb_cz where 车次='" & Combo1.Text & "' and 路过站='" & Text2(1).Text & "'", cnn, adOpenKeyset, adLockOptimistic
If rs.RecordCount > 0 Then
MsgBox "该车站已存在", , "学生订票管理系统"
Exit Sub
End If
rs.Close
If Text2(1).Text = "" Then
MsgBox "请输入完整信息!", , "学生订票管理系统"
Exit Sub
End If
If IsNumeric(Text2(3).Text) = False Then
MsgBox "请输入正确的价格", , "学生订票管理系统"
Exit Sub
End If
If IsNumeric(Text2(2).Text) = False Then
MsgBox "车站代码为数值型!", , "学生订票管理系统"
Exit Sub
End If
If Label19.Caption <> "" And Val(Text2(2).Text) > Label19.Caption Then
MsgBox "车站代码过大", , "学生订票管理系统"
Exit Sub
End If
Call Tcode
rs1.Open "select * from tb_ccxx where 车次='" & Combo1.Text & "' ", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
rs.Open "select * from tb_cz", cnn, adOpenKeyset, adLockOptimistic
rs.AddNew
rs.Fields(0) = Combo1.Text
For i = 1 To 2
rs.Fields(i) = Text2(i).Text
Next i
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 "站点添加完成", , "学生订票管理系统"
Else
MsgBox "该车次不存在,请先录入车次信息", , "学生订票管理系统"
End If
rs1.Close
Call code
End Sub
Private Sub code()
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
rs.Open "select *from tb_cz where 车次='" & Combo1.Text & "'order by 车站代码", cnn, adOpenKeyset, adLockOptimistic
If rs.RecordCount > 0 Then
rs.MoveLast
Label19.Caption = Val(rs.Fields("车站代码")) + 1
Text2(2).Text = Format(Label19.Caption, "00")
Else
Label19.Caption = 1
Text2(2).Text = Format(Label19.Caption, "00")
End If
rs.Close
End Sub
Private Sub Tcode()
Dim rs As New ADODB.Recordset
If Val(Text2(2).Text) < Label19.Caption And Val(Text2(2).Text) > 0 Then
If MsgBox("确定要插入车站到此代码的车站之前", 4, "学生订票管理系统") = vbYes Then
rs.Open "select * from tb_cz where 车次='" & Combo1.Text & "'and 车站代码>='" & Text2(2).Text & "' order by 车站代码", cnn, adOpenKeyset, adLockOptimistic
If rs.RecordCount > 0 Then
rs.MoveFirst
For i = 1 To rs.RecordCount
rs.Fields("车站代码") = Format(Val(rs.Fields("车站代码")) + 1, "00")
rs.MoveNext
Next i
Else
Text2(2).Text = Format(Label19.Caption, "00")
End If
End If
End If
End Sub
Private Sub Form_Load()
Dim s, m
For i = 0 To 7
Text1(i).Text = ""
Next i
For i = 1 To 3
Text2(i).Text = ""
Next i
s = "select 车次 from tb_ccxx "
m = "车次"
Call Frm_dpgl.add(Combo1, s, m)
Combo1.Text = "选择车次"
Label19.Caption = "1"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -