⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addtrain.frm

📁 此系统实现了火车票订票系统的部分功能
💻 FRM
字号:
VERSION 5.00
Begin VB.Form form2 
   Caption         =   "添加车次窗口"
   ClientHeight    =   4650
   ClientLeft      =   60
   ClientTop       =   405
   ClientWidth     =   5535
   LinkTopic       =   "Form2"
   ScaleHeight     =   4650
   ScaleWidth      =   5535
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command3 
      Caption         =   "退出"
      Height          =   495
      Left            =   3360
      TabIndex        =   16
      Top             =   3840
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "重填"
      Height          =   495
      Left            =   1920
      TabIndex        =   15
      Top             =   3840
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "添加"
      Height          =   495
      Left            =   480
      TabIndex        =   14
      Top             =   3840
      Width           =   855
   End
   Begin VB.TextBox Text4 
      Height          =   495
      Left            =   1320
      TabIndex        =   13
      Top             =   1560
      Width           =   1215
   End
   Begin VB.TextBox Text7 
      Height          =   495
      Left            =   1320
      TabIndex        =   7
      Top             =   3000
      Width           =   1215
   End
   Begin VB.TextBox Text6 
      Height          =   495
      Left            =   3840
      TabIndex        =   6
      Top             =   2280
      Width           =   1215
   End
   Begin VB.TextBox Text5 
      Height          =   495
      Left            =   1320
      TabIndex        =   5
      Top             =   2280
      Width           =   1215
   End
   Begin VB.TextBox Text3 
      Height          =   495
      Left            =   3720
      TabIndex        =   4
      Top             =   840
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      Height          =   495
      Left            =   1320
      TabIndex        =   3
      Top             =   840
      Width           =   1215
   End
   Begin VB.TextBox Text1 
      Height          =   495
      Left            =   1320
      TabIndex        =   2
      Top             =   120
      Width           =   1095
   End
   Begin VB.Label Label7 
      Caption         =   "乘车时间:"
      Height          =   495
      Left            =   360
      TabIndex        =   12
      Top             =   3000
      Width           =   1215
   End
   Begin VB.Label Label5 
      Caption         =   "出发时间:"
      Height          =   375
      Left            =   360
      TabIndex        =   11
      Top             =   2310
      Width           =   975
   End
   Begin VB.Label Label4 
      Caption         =   "列车类型:"
      Height          =   375
      Left            =   360
      TabIndex        =   10
      Top             =   1620
      Width           =   975
   End
   Begin VB.Label Label2 
      Caption         =   "始点站:"
      Height          =   375
      Left            =   360
      TabIndex        =   9
      Top             =   930
      Width           =   855
   End
   Begin VB.Label Label1 
      Caption         =   "车次:"
      Height          =   375
      Left            =   360
      TabIndex        =   8
      Top             =   240
      Width           =   975
   End
   Begin VB.Label Label6 
      Caption         =   "到达时间:"
      Height          =   495
      Left            =   2760
      TabIndex        =   1
      Top             =   2280
      Width           =   1095
   End
   Begin VB.Label Label3 
      Caption         =   "终点站:"
      Height          =   375
      Left            =   2880
      TabIndex        =   0
      Top             =   930
      Width           =   855
   End
End
Attribute VB_Name = "form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim cmd As ADODB.Command

Private Sub Command1_Click()
 If Text1.Text = "" Then
    MsgBox "车次不能为空!", vbOKOnly + vbExclamation, "警告"
    Text1.SetFocus
    Exit Sub
 Else
    If Text2.Text = "" Then
       MsgBox "始点站不能为空!", vbOKOnly + vbExclamation, "警告"
       Text2.SetFocus
       Exit Sub
     Else
       If Text3.Text = "" Then
          MsgBox "终点站不能为空!", vbOKOnly + vbExclamation, "警告"
          Text3.SetFocus
          Exit Sub
       Else
          If Text4.Text = "" Then
             MsgBox "列车类型不能为空!", vbOKOnly + vbExclamation, "警告"
             Text4.SetFocus
             Exit Sub
           Else
             If Text5.Text = "" Then
                MsgBox "出发时间不能为空!", vbOKOnly + vbExclamation, "警告"
                Text5.SetFocus
                Exit Sub
              Else
                If Text6.Text = "" Then
                   MsgBox "到达时间不能为空!", vbOKOnly + vbExclamation, "警告"
                   Text6.SetFocus
                   Exit Sub
                 Else
                   If Text7.Text = "" Then
                       MsgBox "乘车时间不能为空!", vbOKOnly + vbExclamation, "警告"
                       Text7.SetFocus
                       Exit Sub
                    Else
                       Call databaseopen
                       Set conn = New ADODB.Connection
                       Set rst = New ADODB.Recordset
                       rst = conn.Execute("exec selecttrain" _
                                        & "'" & Text1.Text & "'")
                       If rst.EOF = True Then
                          Dim RS1 As New ADODB.Recordset
                          Set RS1 = conn.Execute("exec inserttrainticket" _
                          & "'" & Text1.Text & "'," _
                          & "'" & Text2.Text & "'," _
                          & "'" & Text3.Text & "'," _
                          & "'" & Text4.Text & "'," _
                          & "'" & Text5.Text & "'," _
                          & "'" & Text6.Text & "'," _
                          & "'" & Text7.Text & "'")
                          MsgBox "火车车次添加成功!", vbOKOnly + vbExclamation, "提示"
                          Call databaseclose
                        Else
                          MsgBox "此火车已存在", vbOKOnly + vbExclamation, "警告"
                        End If
                    End If
                   End If
                End If
               End If
            End If
         End If
      End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -