Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
0
Добавлен:
30.05.2020
Размер:
3 Кб
Скачать
☆
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, DBCtrls, DBTables, DB, StdCtrls, Grids, DBGrids;

type
  TForm1 = class(TForm)
    Label1: TLabel;
    DBGrid1: TDBGrid;
    DBGrid2: TDBGrid;
    ComboBox1: TComboBox;
    Label2: TLabel;
    Table1: TTable;
    DataSource1: TDataSource;
    Query1: TQuery;
    DBNavigator1: TDBNavigator;
    procedure ComboBox1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

procedure TForm1.ComboBox1Change(Sender: TObject);
var x:integer;
begin
x:=combobox1.itemindex;
case x of
0:begin
with Query1 do
begin
    if not(fileexists('tab.db')) then begin
    Active:=False;
    SQL.Clear;
    sql.Add('Create table "tab.db"');
    sql.Add('(PIP char(50), Posada char(20), Zarplata float(8))');
    ExecSQL;
    end
    else begin
  active:=false;
  sql.clear;
  sql.add('DELETE FROM "tab.db"');
  execSQL;
         end;
    active:=false;
    sql.Clear;
    sql.Add('insert into "tab.db"(PIP, Posada, Zarplata)');
    sql.add('select PIP, Posada, Zarplata');
    sql.Add('from "robitnuk.DB"');
    sql.Add('where  zarplata<500');
    execsql;
    active:=false;
    sql.Clear;
    sql.Add('select *');
    sql.Add('from "tab.db"');
    active:=true;
end;
end;


1:begin
with Query1 do
begin
active:=false;
sql.clear;
sql.Add('select PIP, Posada, Zarplata');
sql.Add('from "robitnuk.db"');
sql.Add('where zarplata>500');
active:=true;
end;
end;

2:begin
with Query1 do
begin
active:=false;
sql.clear;
sql.Add('select PIP, D_narod, Sim_stan');
sql.Add('from "robitnuk.DB"');
sql.Add('where d_narod>1993');
active:=true;
end;
end;

3:begin
with Query1 do
begin
active:=false;
sql.clear;
sql.Add('insert into "robitnuk.DB"');
sql.Add('values ("Кукарін Валерій Олексійович", "разноробочий", 200, 1985, "не одружений")');
execsql;
active:=false;
sql.Clear;
sql.Add('select *');
sql.Add('from "robitnuk.db"');
active:=true;
end;
end;

4:begin
with Query1 do
begin
active:=false;
sql.clear;
sql.Add('Delete');
sql.Add('from "robitnuk.DB"');
sql.Add('where d_narod=1985');
execsql;
active:=false;
sql.Clear;
sql.Add('select *');
sql.Add('from "robitnuk.db"');
active:=true;
end;
end;

5:begin
with query1 do
begin
active:=false;
sql.clear;
sql.Add('update "robitnuk.DB"');
sql.Add('set zarplata=zarplata*5');
sql.Add('where zarplata>500');
execsql;
active:=false;
sql.Clear;
sql.Add('select *');
sql.Add('from "robitnuk.db"');
active:=true;
end;
end;


end;
end;




end.
Соседние файлы в папке Артем