关闭程序前请将使用的数据集关闭,如Table1.Close;

解决方案 »

  1.   

    代码有点长:
    object Form1: TForm1
      Left = 216
      Top = 105
      AutoScroll = False
      Caption = '订票查询'
      ClientHeight = 545
      ClientWidth = 746
      Color = clBtnFace
      Font.Charset = DEFAULT_CHARSET
      Font.Color = clWindowText
      Font.Height = -11
      Font.Name = 'MS Sans Serif'
      Font.Style = []
      Menu = MainMenu1
      OldCreateOrder = False
      OnClose = FormClose
      PixelsPerInch = 96
      TextHeight = 13
      object Label1: TLabel
        Left = 0
        Top = 5
        Width = 65
        Height = 13
        AutoSize = False
        Caption = '班机信息'
      end
      object Label2: TLabel
        Left = 0
        Top = 224
        Width = 121
        Height = 13
        AutoSize = False
        Caption = '此班机的订票情况'
      end
      object Label3: TLabel
        Left = 520
        Top = 4
        Width = 73
        Height = 13
        AutoSize = False
        Caption = '请输入终点'
      end
      object DBGrid1: TDBGrid
        Left = 0
        Top = 24
        Width = 745
        Height = 193
        DataSource = DataSource1
        TabOrder = 0
        TitleFont.Charset = DEFAULT_CHARSET
        TitleFont.Color = clWindowText
        TitleFont.Height = -11
        TitleFont.Name = 'MS Sans Serif'
        TitleFont.Style = []
      end
      object DBGrid2: TDBGrid
        Left = 0
        Top = 240
        Width = 745
        Height = 305
        DataSource = DataSource2
        TabOrder = 1
        TitleFont.Charset = DEFAULT_CHARSET
        TitleFont.Color = clWindowText
        TitleFont.Height = -11
        TitleFont.Name = 'MS Sans Serif'
        TitleFont.Style = []
      end
      object DBLookupComboBox1: TDBLookupComboBox
        Left = 584
        Top = 0
        Width = 161
        Height = 21
        KeyField = '终点'
        ListField = '终点'
        ListSource = DataSource3
        TabOrder = 2
        OnClick = DBLookupComboBox1Click
      end
      object MainMenu1: TMainMenu
        Left = 160
        Top = 65512
        object N1: TMenuItem
          Caption = '退出'
        end
        object N2: TMenuItem
          Caption = '显示'
        end
        object N3: TMenuItem
          Caption = '帮助'
          object N4: TMenuItem
            Caption = '关于'
          end
        end
      end
      object ADOConnection1: TADOConnection
        Connected = True
        ConnectionString = 
          'Provider=MSDAORA.1;Password=developer;User ID=dev;Data Source=be' +
          'q-local;Persist Security Info=True'
        LoginPrompt = False
        Provider = 'MSDAORA.1'
        Left = 136
        Top = 216
      end
      object DataSource1: TDataSource
        DataSet = ADODataSet1
        Left = 344
        Top = 80
      end
      object DataSource2: TDataSource
        DataSet = ADODataSet2
        Left = 376
        Top = 296
      end
      object ADODataSet2: TADODataSet
        Connection = ADOConnection1
        Parameters = <>
        Left = 208
        Top = 264
      end
      object ADODataSet3: TADODataSet
        Active = True
        Connection = ADOConnection1
        CursorType = ctStatic
        CommandText = 'select distinct 终点 from 航班 group by 终点'
        Parameters = <>
        Left = 464
        Top = 65528
        object ADODataSet3DSDesigner: TStringField
          FieldName = '终点'
          Size = 100
        end
      end
      object DataSource3: TDataSource
        DataSet = ADODataSet3
        Left = 416
        Top = 65528
      end
      object ADODataSet1: TADODataSet
        Connection = ADOConnection1
        CommandText = 
          'select  航班号, 起点, 起飞日期, 起飞时刻, 到达时刻,'#13#10' 座位总数, 空位数 from 航班 where 终点 ' +
          '= :终点'
        Parameters = <
          item
            Name = '终点'
            Size = -1
            Value = Null
          end>
        Left = 168
        Top = 104
      end
    end