Смекни!
smekni.com

Анализ состояния геоинформационных технологий в решении типовых задач управления региональной недвижимостью Тульской области (стр. 19 из 19)

Dialogs, DB, IBDatabase, IBCustomDataSet, IBQuery, Grids, DBGrids,

Provider, DBClient, DBLocal, DBLocalI, StdCtrls, Buttons, ADODB, ExtCtrls, Gauges;

type

TForm1 = class(TForm)

IBOLD: TIBDatabase;

IBNEW: TIBDatabase;

IBTrOLD: TIBTransaction;

IBTrNEW: TIBTransaction;

IBQOLD: TIBQuery;

IBQNEW: TIBQuery;

DBGrid1: TDBGrid;

IBQNEWID_OBJ: TIBStringField;

IBQNEWNUMZAYAV_OBJLOT: TIBStringField;

IBQOLDID_OBJ: TIBStringField;

DataSource1: TDataSource;

IBQOLDNUMZAYAV_OBJLOT: TIBStringField;

DataSource2: TDataSource;

DBGrid2: TDBGrid;

BitBtn1: TBitBtn;

OpenDialog1: TOpenDialog;

BitBtn2: TBitBtn;

Edit1: TEdit;

Label1: TLabel;

Label2: TLabel;

Edit2: TEdit;

Edit3: TEdit;

Label3: TLabel;

Bevel1: TBevel;

Label4: TLabel;

Edit4: TEdit;

Label5: TLabel;

Label6: TLabel;

Edit5: TEdit;

Edit6: TEdit;

Label7: TLabel;

Bevel2: TBevel;

Label8: TLabel;

OpenDialog2: TOpenDialog;

BitBtn3: TBitBtn;

Gauge1: TGauge;

procedure BitBtn1Click(Sender: TObject);

procedure BitBtn2Click(Sender: TObject);

procedure BitBtn3Click(Sender: TObject);

private

procedure Set_IBOLD_Params;

procedure Set_IBNEW_Params;

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Set_IBOLD_Params;

begin

IBOLD.DatabaseName:=Edit3.Text;

with IBOLD.Params do begin

Clear;

Add('user_name='+trim(Edit1.Text));

Add('password='+trim(Edit2.Text));

Add('lc_ctype=WIN1251');

end;

end;

procedure TForm1.Set_IBNEW_Params;

begin

IBNEW.DatabaseName:=Edit6.Text;

with IBNEW.Params do begin

Clear;

Add('user_name='+trim(Edit4.Text));

Add('password='+trim(Edit5.Text));

Add('lc_ctype=WIN1251');

end;

end;

procedure TForm1.BitBtn1Click(Sender: TObject);

begin

Gauge1.Visible:=True;

Gauge1.Progress:=0;

IBQOLD.First;

While NOT IBQOLD.Eof do

begin

if IBQOLDNUMZAYAV_OBJLOT.AsString<>'' then

begin

IBNEW.Close;

IBQNEW.SQL.Clear;

//IBQNEW.SQL.Text:='select * from objlot where ID_OBJ='''+IBQOLDID_OBJ.AsString+'''';

IBQNEW.SQL.Text:='update objlot set NUMZAYAV_OBJLOT='''+IBQOLDNUMZAYAV_OBJLOT.AsString+

''' where ID_OBJ='''+IBQOLDID_OBJ.AsString+'''';

IBQNEW.ExecSQL;

// IBQNEW.Open;

Application.ProcessMessages;

end;

Application.ProcessMessages;

IBQOLD.Next;

Gauge1.Progress:=round(IBQOLD.RecNo/IBQOLD.RecordCount*100);

end;

ShowMessage('Operation COMPLETE');

Gauge1.Visible:=False;

//--------------------обработка в IB---------------

IBNEW.Close;

IBQNEW.SQL.Clear;

IBQNEW.SQL.Text:='SELECT * FROM objlot';

IBQNEW.Active:=True;

end;

procedure TForm1.BitBtn2Click(Sender: TObject);

begin

with OpenDialog1 do

begin

Filter:='gсf - файлы GeoCad|*.gdb';

if Execute then Edit3.Text:=FileName;

end;

IBOLD.Close;

Set_IBOLD_Params;

IBOLD.Open;

IBQOLD.Open;

end;

procedure TForm1.BitBtn3Click(Sender: TObject);

begin

with OpenDialog2 do

begin

Filter:='gdb - файлы БД|*.gdb';

if Execute then Edit6.Text:=FileName;

end;

IBNEW.Close;

Set_IBNEW_Params;

IBNEW.Open;

IBQNEW.Open;

end;

end.