while not eof do begin
t.TableName := ItemName;
TableUpdate(t);
Next;
end;
Close;
{Формирование БД переносимых LPU и счетов}
{ если весь счет забракован в ошибки, то усложняется SQL на INSERT в z.dbf }
with dm1.Query2 do
begin
sql.Clear;
case reg of
1: sql.Add('INSERT INTO "z" (kod_lpu, n_ch, dat_sc, vid) select distinct kod_lpu, n_ch, dat_sc, 1 as vid from sta ');
2: sql.Add('INSERT INTO "z" (kod_lpu, n_ch, dat_sc, vid) select distinct kod_lpu, n_ch, dat_sc, 2 as vid from amb ');
4: sql.Add('INSERT INTO "z" (kod_lpu, n_ch, dat_sc, vid) select distinct kod_lpu, n_ch, dat_sc, 4 as vid from sto ');
end;
ExecSQL;
sql.Clear;
case reg of
1: sql.Add('INSERT INTO "z" (kod_lpu, n_ch, dat_sc, vid) select distinct kod_lpu, n_ch, dat_sc, 1 as vid from sta_bad where kod_lpu not in (select distinct kod_lpu from sta) ');
2: sql.Add('INSERT INTO "z" (kod_lpu, n_ch, dat_sc, vid) select distinct kod_lpu, n_ch, dat_sc, 2 as vid from amb_bad where kod_lpu not in (select distinct kod_lpu from amb) ');
4: sql.Add('INSERT INTO "z" (kod_lpu, n_ch, dat_sc, vid) select distinct kod_lpu, n_ch, dat_sc, 4 as vid from sto_bad where kod_lpu not in (select distinct kod_lpu from sto) ');
end;
ExecSQL;
Close;
end;
end;
t.Free;
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Icon := Application.Icon;
ToolBar1.Buttons[0].Down := True;
Label1.Caption := '';
Label2.Caption := '';
try
dm1.dbORA.Connected := True;
except
MessageDlg('Ошибка при подключении к серверу ORACLE(WG73)!', mtWarning, [mbOK], 0);
end;
end;
procedure TForm1.ToolButton1Click(Sender: TObject);
begin
ChangeLangDrv('db866ru0');
Close;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
ChangeLangDrv('db866ru0');
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
ChangeLangDrv('db866ru0');
end;
end.