Тема: Условие
Показать сообщение отдельно
  #2  
Старый 08.09.2011, 14:47
Аватар для NumLock
NumLock NumLock вне форума
Let Me Show You
 
Регистрация: 30.04.2010
Адрес: Северодвинск
Сообщения: 5,426
Версия Delphi: 7, XE5
Репутация: 59586
По умолчанию

Код:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, DBTables;

type
  TForm1 = class(TForm)
    CheckBox1: TCheckBox;
    CheckBox2: TCheckBox;
    CheckBox3: TCheckBox;
    CheckBox4: TCheckBox;
    Button1: TButton;
    Query1: TQuery;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  Tag:=0;
  Tag:=Tag+Integer(CheckBox1.Checked);
  Tag:=Tag+Integer(CheckBox2.Checked);
  Tag:=Tag+Integer(CheckBox3.Checked);
  Tag:=Tag+Integer(CheckBox4.Checked);
  case Tag of
    0: Query1.SQL.Text:='select 0';
    1: Query1.SQL.Text:='select 1';
    2: Query1.SQL.Text:='select 2';
    3: Query1.SQL.Text:='select 3';
    4: Query1.SQL.Text:='select 4';
  end;
end;

end.
__________________
Пишу программы за еду.
__________________
Ответить с цитированием