Методичні вказівки до обов’язкового домашнього завдання з дисципліни «Організація баз даних та знань», страница 8

      'Select min(T) as minT,    min(P) as minPW,

                  max(T) as maxT,  max(P) as maxPW

       from NH3TD_SATUR Where (Sub_ID = :id)')

  end

  object quIntT: TSQLQuery

    SQL.Strings = (

      'select SUB_ID, T, P, VSPL, VSPW, IL, IW, SL, SW

       from NH3TD_SATUR

       Where  ( (SUB_ID = :id1) and (T =

        (Select Max(T) from NH3TD_SATUR  Where (T <= :t1))))

       UNION ALL

       select SUB_ID, T, P, VSPL, VSPW, IL, IW, SL, SW

       from NH3TD_SATUR

       Where  ( (SUB_ID = :id2) and (T =

        (Select min(T) from NH3TD_SATUR  Where (T >= :t2))))

         order by 2 ASC')

  end

  object quIntPW: TSQLQuery

    SQL.Strings = (

      'select SUB_ID, T, P, VSPL, VSPW, IL, IW, SL, SW

       from NH3TD_SATUR

       Where  ( (SUB_ID = :id1) and (P =

        (Select Max(P) from NH3TD_SATUR

         Where (P <= :p1) ) ) )

       UNION ALL

      select SUB_ID, T, P, VSPL, VSPW, IL, IW, SL, SW

      from NH3TD_SATUR

      Where  ( (SUB_ID = :id2) and (P =

       (Select min(P) from NH3TD_SATUR  Where (P >= :p2))))

       order by 3 ASC')

  end

  object taNH3sh: TSQLDataSet

    CommandText =

    'select SUB_ID, P, T, VW, IW, SW from NH3TD_SHW

     Where (SUB_ID = :id)  Order by P, T'

  end

  object taNH3_Satur: TSQLDataSet

    CommandText = 'select SUB_ID, T, P, VSPL, VSPW, IL, IW, SL, SW from NH3TD_SATUR' +

                  'Where (SUB_ID = :id) Order by T'

  end

  object qu4P: TSQLQuery

    SQL.Strings = (

      'Select 1 as n, P, T, VW, IW, SW from NH3TD_SHW'

       Where ((P= (Select Max(P) From NH3TD_SHW

                   where P <= :x1)) and

              (T= (Select Max(T) From NH3TD_SHW

                   where T <= :y1)) and (SUB_ID=:id1) )

         UNION ALL

       Select 2 as n, P, T, VW, IW, SW from NH3TD_SHW

       Where ((P= (Select Max(P) From NH3TD_SHW

                   where P <= :x2)) and

              (T= (Select min(T) From NH3TD_SHW

                   where T >= :y2)) and (SUB_ID=:id2) )

         UNION ALL

       Select 3 as n, P, T, VW, IW, SW from NH3TD_SHW

       Where ((P= (Select min(P) From NH3TD_SHW

                   where P >= :x3)) and'

              (T= (Select min(T) From NH3TD_SHW

                   where T >= :y3)) and (SUB_ID=:id3) )

         UNION ALL

       Select 4 as n, P, T, VW, IW, SW from NH3TD_SHW

       Where ((P= (Select min(P) From NH3TD_SHW

                   where P >= :x4)) and

              (T= (Select Max(T) From NH3TD_SHW

                   where T <= :y4)) and   (SUB_ID=:id4) )

       Order by 1')

  end

end

Форма коригування груп и речовин(матеріалів).

Рисунок 4. Зовнішній вигляд форми груп та речовин

unit uFmGr;

interface

uses  Windows, Messages, SysUtils, Variants, Classes, 

      Graphics, Controls, Forms,  Dialogs, DBCtrls, Grids,

      DBGrids, ExtCtrls, StdCtrls, Buttons;

type

  TfmGrSub = class(TForm)

    Panel1: TPanel;  Panel2: TPanel;   Panel3: TPanel;

    Splitter1: TSplitter;  Panel4: TPanel;  Panel5: TPanel;

    paInd: TPanel;   dgGroups: TDBGrid;

    DBNavigator1: TDBNavigator;

    DBNavigator2: TDBNavigator;

    bbUp: TBitBtn;  bbDown: TBitBtn;  bbRoot: TBitBtn;   

    bTest: TButton; bbClose: TBitBtn;  bbOK: TBitBtn;

    bbCancel: TBitBtn; dgSubst: TDBGrid;

    procedure bbDownClick(Sender: TObject);

    procedure bbRootClick(Sender: TObject);

    procedure bTestClick(Sender: TObject);

    procedure bbUpClick(Sender: TObject);

  private     { Private declarations }

  public      { Public declarations }

    Function ChoiceSubstance :Boolean;

  end;

var

  Code :Integer;  // Код ошибки в преобразованиях

  fmGrSub: TfmGrSub;

function RusValToEng(s: String): string;

Function GetReal(s:String) :Extended;

function CheckReal(ed: TEdit):Boolean;

implementation

uses uDM;

{$R *.dfm}

procedure TfmGrSub.bbDownClick(Sender: TObject);

{ ***********************************************

  *   Переход к подгруппе (на уровень вниз).    *

  *********************************************** }

begin