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

📄 frm_sycp.frm

📁 采用VB编写的学生订票管理系统 有详细的代码~解压后可以直接使用!~附有使用说明
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Begin VB.Form Frm_sycp 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "剩余车票查询"
   ClientHeight    =   3855
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6840
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   ScaleHeight     =   3855
   ScaleWidth      =   6840
   StartUpPosition =   2  '屏幕中心
   Begin MSHierarchicalFlexGridLib.MSHFlexGrid MS1 
      Height          =   2910
      Left            =   15
      TabIndex        =   5
      Top             =   855
      Width           =   6720
      _ExtentX        =   11853
      _ExtentY        =   5133
      _Version        =   393216
      _NumberOfBands  =   1
      _Band(0).Cols   =   2
   End
   Begin VB.CommandButton Command1 
      Caption         =   "查询"
      Height          =   345
      Left            =   5640
      TabIndex        =   4
      Top             =   15
      Width           =   900
   End
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   345
      Left            =   5655
      TabIndex        =   3
      Top             =   420
      Width           =   900
   End
   Begin VB.Frame Frame1 
      Height          =   705
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   5445
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   570
         TabIndex        =   8
         Top             =   210
         Width           =   1695
      End
      Begin MSComCtl2.DTPicker DTP1 
         Height          =   390
         Left            =   2850
         TabIndex        =   7
         Top             =   210
         Width           =   1755
         _ExtentX        =   3096
         _ExtentY        =   688
         _Version        =   393216
         Format          =   69533697
         CurrentDate     =   39457
      End
      Begin VB.Label Label4 
         Caption         =   "日期"
         Height          =   285
         Left            =   2325
         TabIndex        =   2
         Top             =   285
         Width           =   405
      End
      Begin VB.Label Label1 
         Caption         =   "车次"
         Height          =   255
         Left            =   105
         TabIndex        =   1
         Top             =   285
         Width           =   450
      End
   End
   Begin VB.Label Label2 
      Caption         =   "Label2"
      Height          =   495
      Left            =   2010
      TabIndex        =   6
      Top             =   4050
      Width           =   1590
   End
End
Attribute VB_Name = "Frm_sycp"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Command1_Click()
    Dim rs As New ADODB.Recordset
    Dim rs1 As New ADODB.Recordset
    Dim i, j As Integer
    Dim a, s, m
    Call title
    rs.Open "select * from tb_ccxx where 车次='" & Combo1.Text & "'", cnn, adOpenKeyset, adLockOptimistic
    If rs.RecordCount > 0 Then
        For m = 0 To 5
            MS1.TextMatrix(MS1.Row, m) = rs.Fields(m)
        Next m
        a = Array("硬座", "软座", "硬卧", "软卧")
        For j = 0 To 3
            rs1.Open "select count(*)as 数量 from tb_cpyd where 车次='" & Combo1.Text & "'and 乘坐方式 like '%" & a(j) & "%' and 乘坐日期='" & DTP1.Value & "'and 备注= '订票'", cnn, adOpenKeyset, adLockOptimistic
            s = a(j) & "数量"
            If rs.Fields("" & s & "") = "\" Then
                MS1.TextMatrix(MS1.Row, 6 + j) = "\"
            Else
                If rs.Fields("" & s & "") - rs1.Fields("数量") >= 1 Then
                    Label2.Caption = "有座"
                Else
                    Label2.Caption = "无座"
                End If
                MS1.TextMatrix(MS1.Row, 6 + j) = Label2.Caption
            End If
            rs1.Close
        Next j
    End If
    rs.Close
End Sub

Private Sub Command2_Click()
    Unload Me
    Frm_main.Show
End Sub

Private Sub DTP1_change()
    If DTP1.Value < Date Then
        MsgBox "日期不能小于今天", , "学生订票管理系统"
        DTP1.Value = Date
        Exit Sub
    End If
End Sub

Private Sub Form_Load()
    Dim rs As New ADODB.Recordset
    Dim rs1 As New ADODB.Recordset
    Dim i, j, m
    Dim a, s
    DTP1.Value = Date
    Call title
    rs.Open "select * from tb_ccxx", cnn, adOpenKeyset, adLockOptimistic
   If rs.RecordCount > 0 Then rs.MoveFirst
    For i = 1 To rs.RecordCount
        a = Array("硬座", "软座", "硬卧", "软卧")
        For m = 0 To 5
            MS1.TextMatrix(i, m) = rs.Fields(m)
        Next m
        For j = 0 To 3
            rs1.Open "select count(*)as 数量 from tb_cpyd where 车次='" & rs.Fields("车次") & "'and 乘坐方式 like '%" & a(j) & "%' and 乘坐日期='" & Date & "'", cnn, adOpenKeyset, adLockOptimistic
            s = a(j) & "数量"
            If rs.Fields("" & s & "") = "\" Then
                MS1.TextMatrix(i, 6 + j) = "\"
            Else
                If rs.Fields("" & s & "") - rs1.Fields("数量") >= 1 Then
                    Label2.Caption = "有座"
                Else
                    Label2.Caption = "无座"
                End If
                MS1.TextMatrix(i, 6 + j) = Label2.Caption
            End If
            rs1.Close
        Next j
        rs.MoveNext
    Next i
    rs.Close
    s = "select distinct 车次 from tb_ccxx"
    m = "车次"
    Call Frm_dpgl.add(Combo1, s, m)
End Sub

Private Sub title()
    Dim s, i
    MS1.Clear
    MS1.Cols = 10
    MS1.Rows = 20
    s = Array("车次", "类型", "始发站", "始发时间", "终到站", "终到时间", "硬座", "软座", "硬卧", "软卧")
    For i = 0 To 9
        MS1.TextMatrix(0, i) = s(i)
    Next i
End Sub

⌨️ 快捷键说明

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