📄 foraddtraindata.frm
字号:
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3120
TabIndex = 13
Top = 360
Width = 1095
End
Begin VB.Label Label7
BackColor = &H00C0E0FF&
Caption = " 到站时间"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 6000
TabIndex = 12
Top = 360
Width = 975
End
Begin VB.Label Label6
BackColor = &H00C0E0FF&
Caption = "始发时间"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 6000
TabIndex = 11
Top = 1080
Width = 975
End
Begin VB.Label Label5
BackColor = &H00C0E0FF&
Caption = "途经站"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 9
Top = 3120
Width = 855
End
Begin VB.Label Label4
BackColor = &H00C0E0FF&
Caption = "目的站"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 4
Top = 2400
Width = 975
End
Begin VB.Label Label3
BackColor = &H00C0E0FF&
Caption = "起始站"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 3
Top = 1800
Width = 975
End
Begin VB.Label Label2
BackColor = &H00C0E0FF&
Caption = "列车类型"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 2
Top = 1200
Width = 975
End
Begin VB.Label Label1
BackColor = &H00C0E0FF&
Caption = "车次"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 480
TabIndex = 1
Top = 360
Width = 975
End
End
Begin VB.Image Image1
Height = 11520
Left = -4320
Picture = "ForAddTrainData.frx":149E
Top = -480
Width = 15360
End
End
Attribute VB_Name = "ForAddTrainData"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox "车次不能为空!!!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
If Text2.Text = "" Then
MsgBox "列车类型不能为空!!!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
If Text3.Text = "" Then
MsgBox "起点站不能为空!!!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
If Text4.Text = "" Then
MsgBox "目的站不能为空!!!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
If Text5.Text = "" Then
MsgBox "途经站不能为空!!!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
If Text6.Text = "" Then
MsgBox "硬座车厢数不能为空!!!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
If Text6.Text <> "" Then
If Not IsNumeric(Text6.Text) Then
MsgBox "硬座车厢数应为数字!!!", vbOKOnly + vbExclamation, "提示"
Text6.SetFocus
Text6.Text = ""
Exit Sub
End If
End If
If Text7.Text = "" Then
MsgBox "硬卧车厢数价格不能为空!!!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
If Text7.Text <> "" Then
If Not IsNumeric(Text7.Text) Then
MsgBox "硬卧车厢数应为数字!!!", vbOKOnly + vbExclamation, "提示"
Text7.SetFocus
Text7.Text = ""
Exit Sub
End If
End If
If Text8.Text = "" Then
MsgBox "软座车厢数不能为空!!!", vbOKOnly + vbExclamation, "提示"
End If
If Text8.Text <> "" Then
If Not IsNumeric(Text8.Text) Then
MsgBox "软座车厢数应为数字!!!", vbOKOnly + vbExclamation, "提示"
Text8.SetFocus
Text8.Text = ""
Exit Sub
End If
End If
If Text9.Text = "" Then
MsgBox "软卧车厢数不能为空!!!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
If Text9.Text <> "" Then
If Not IsNumeric(Text9.Text) Then
MsgBox "软卧车厢数应为数字!!!", vbOKOnly + vbExclamation, "提示"
Text9.SetFocus
Text9.Text = ""
Exit Sub
End If
End If
If Text10.Text = "" Then
MsgBox "到站时间不能为空!!!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
If Text11.Text = "" Then
MsgBox "始发时间不能为空!!!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
If Text12.Text = "" Then
MsgBox "车厢座位数不能为空!!!", vbOKOnly + vbExclamation, "提示"
Exit Sub
End If
If Text12.Text <> "" Then
If Not IsNumeric(Text12.Text) Then
MsgBox "车厢座位数应为数字!!!", vbOKOnly + vbExclamation, "提示"
Text12.SetFocus
Text12.Text = ""
Exit Sub
End If
End If
'Adodc1.RecordSource = "Insert into 列车数据表 values('" & Text1.Text & "','" & Text2.Text _
'& "','" & Text3.Text & "','" & Text4.Text & "','" & Text5.Text & "','" & Text6.Text & "','" & Text7.Text _
'& "','" & Text8.Text & "','" & Text9.Text & "','" & Text10.Text & "','" & Text11.Text _
'& "','" & Text12.Text & "')"
'Adodc1.Refresh
If ForTrainData.AddOrModify = False Then
ForTrainData.Adodc1.Recordset.Delete
End If
Adodc1.Refresh
Adodc1.RecordSource = "select * from 列车数据表 where 车次='" & Text1.Text & "'"
Adodc1.Refresh
If Adodc1.Recordset.EOF = False Or Adodc1.Recordset.BOF = False Then
MsgBox "您输入的车次有重复!请输入其它编号!!!"
Text1.SetFocus
Exit Sub
End If
Adodc1.Recordset.AddNew
Adodc1.Recordset("车次") = Trim(Text1.Text)
Adodc1.Recordset("列车类型") = Trim(Text2.Text)
Adodc1.Recordset("起始站") = Trim(Text3.Text)
Adodc1.Recordset("目的站") = Trim(Text4.Text)
Adodc1.Recordset("途经站") = Trim(Text5.Text)
Adodc1.Recordset("硬座车厢数") = Trim(Text6.Text)
Adodc1.Recordset("软座车厢数") = Trim(Text7.Text)
Adodc1.Recordset("硬卧车厢数") = Trim(Text8.Text)
Adodc1.Recordset("软卧车厢数") = Trim(Text9.Text)
Adodc1.Recordset("始发时间") = Trim(Text10.Text)
Adodc1.Recordset("到站时间") = Trim(Text11.Text)
Adodc1.Recordset("车厢座位数") = Trim(Text12.Text)
Adodc1.Recordset.Update
Adodc1.Refresh
MsgBox "信息添加成功!!!", vbOKOnly + vbExclamation, "提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = ""
Text11.Text = ""
Text12.Text = ""
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -