dfm
------------
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Hosxp VN2VN by Doraemon saiyok'
ClientHeight = 492
ClientWidth = 567
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 32
Top = 35
Width = 45
Height = 22
Caption = 'HN (OLD)'
end
object Label2: TLabel
Left = 32
Top = 91
Width = 50
Height = 18
Caption = 'VN'
end
object Label3: TLabel
Left = 32
Top = 147
Width = 48
Height = 13
Caption = 'HN (NEW)'
end
object Label4: TLabel
Left = 80
Top = 224
Width = 31
Height = 13
Caption = 'Label4'
end
object Edit1: TEdit
Left = 96
Top = 32
Width = 153
Height = 41
TabOrder = 0
Text = '0062411'
end
object Edit2: TEdit
Left = 96
Top = 79
Width = 153
Height = 41
TabOrder = 1
Text = '510807210208'
end
object Button1: TButton
Left = 80
Top = 256
Width = 393
Height = 73
Caption = 'Button1'
TabOrder = 2
OnClick = Button1Click
end
object Edit3: TEdit
Left = 96
Top = 144
Width = 153
Height = 41
TabOrder = 3
Text = '0023900'
end
object pg: TProgressBar
Left = 80
Top = 344
Width = 393
Height = 17
TabOrder = 4
end
object logmemo: TMemo
Left = 80
Top = 384
Width = 393
Height = 89
Lines.Strings = (
'logmemo')
TabOrder = 5
end
end
----
pas
----
unit hn2hn;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Button1: TButton;
Edit3: TEdit;
Label3: TLabel;
pg: TProgressBar;
Label4: TLabel;
logmemo: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var tc,ts:tclientdataset; i:integer;
begin
tc:=tclientdataset.create(nil);
ts:=tclientdataset.create(nil);
tc.data:=hosxp_getdataset('select * from hosxp_ddl_field where field_name ="vn"');
pg.position:=0;
pg.max:=tc.recordcount;
while not tc.eof do
begin
label4.caption:=tc.fields[0].asstring;
if tc.fields[1].asstring ='vn' then
begin
logmemo.lines.add('Change...'+tc.fields[0].asstring);
try
hosxp_getdataset('update '+tc.fields[0].asstring+' set hn="'+edit3.text+'" where vn="'+edit2.text+'" and hn="'+edit1.text+'" ');
except end;
end;
logmemo.lines.add('Change...'+'update '+tc.fields[0].asstring+' set hn="'+edit3.text+'" where vn="'+edit2.text+'" and hn="'+edit1.text+'" ');
pg.position:=pg.position+1;
application.processmessages;
tc.next;
end;
tc.free;
ts.free;
showmessage('Done.');
end;
end.