子
子龙
Unregistered / Unconfirmed
GUEST, unregistred user!
//用ADOQUERY1读取.DBF(有20711条记录),
//把AA.dbf的数据转入INTERBASE库中去
procedure TFupdate.B_okClick(Sender: TObject);
var
i, ll, K :integer;
l :string;
begin
ll:=strtoint(Edit1.Text);
l:=Edit1.Text;
l:=copy(l,3,2);
B_ok.Enabled:=False;
B_exit.Enabled:=False;
Edit1.Enabled:=False;
Label2.Caption:='正在更新'+Edit1.Text+'年往来数据......';
Label2.Visible:=True;
Label2.Refresh;
ProgressBar1.Visible:=True;
for i:=1 to 4 do begin
With DM1.ADOQuery1 do begin
Close;
SQL.Clear;
case i of
1: SQL.Add('Select rq,fphm,yxry as gxry,dhdw as dwmc,pm,ph,'+
'kpsl as sl,dj,yunfei,slf,kpje,jsfs,jsdw,jslx,suie,kxlb '+
'from glyk/cwtz'+l+'.dbf');
2: SQL.Add('Select rq,dhdw as dwmc,yxry as gxry,dzje,jsdw,'+
'jsfs,zy,kxlb from glyk/jedz'+l+'.dbf');
3: SQL.Add('Select rq,dddw as dwmc,ddmc as zy,js,yunfei,'+
'zf,ddje,jsdw,yxry as gxry,kxlb from glyk/ddyf'+l+'.dbf');
4: SQL.Add('Select rq,dwmc,gxry,jsdw,kxlb,jqje from bqye.dbf');
end; //case
try
Open;
except
Close;
showmessage('数据更新失败(1-'+inttostr(i)+')!');
exit;
end; //try
end; //with
//DM1.IBupdate (IBQuery)
with DM1.IBupdate do begin
Close;
SQL.Clear;
case i of
1: SQL.Add('insert into wlfp (rq,fphm,gxry,dwmc,pm,ph,sl,dj,'+
'yunfei,slf,kpje,jsfs,jsdw,jslx,suie,kxlb,czry,wlyear)'+
' values rq,:fphm,:gxry,:dwmc,m,h,:sl,:dj,'+
':yunfei,:slf,:kpje,:jsfs,:jsdw,:jslx,:suie,:kxlb,:czry,:wlyear)');
2: SQL.Add('insert into wldz (rq,dwmc,gxry,dzje,jsdw,jsfs,zy,kxlb,wlyear)'+
' values rq,:dwmc,:gxry,:dzje,:jsdw,:jsfs,:zy,:kxlb,:wlyear)');
3: SQL.Add('insert into wlzf (rq,dwmc,zy,js,yunfei,zf,ddje,'+
'jsdw,gxry,kxlb,wlyear) values rq,:dwmc,:zy,:js,'+
':yunfei,:zf,:ddje,:jsdw,:gxry,:kxlb,:wlyear)');
4: SQL.Add('insert into wlbqye (rq,dwmc,gxry,jsdw,kxlb,jqje)'+
' values rq,:dwmc,:gxry,:jsdw,:kxlb,:jqje)');
end; //case
end; //with
with DM1.IBQuery1 do begin
Close;
SQL.Clear;
case i of
1: SQL.Add('Delete from wlfp where wlyear='+Edit1.Text);
2: SQL.Add('Delete from wldz where wlyear='+Edit1.Text);
3: SQL.Add('Delete from wlzf where wlyear='+Edit1.Text);
4: SQL.Add('Delete from wlbqye');
end; //case
DM1.IBTransaction1.StartTransaction;
try
ExecSQL;
DM1.IBTransaction1.Commit;
Close;
except
DM1.IBTransaction1.Rollback;
Close;
messagebeep(0);
showmessage('删除数据失败(2-'+inttostr(i)+')!');
exit;
end; //try
end; //with
with DM1.ADOQuery1 do begin
K:=0;
while not Eof do begin
DM1.IBupdate.ExecSQL;
DM1.IBupdate.ParamByName('rq').AsDate:=DM1.ADOQuery1.FieldByname('rq').Value;
DM1.IBupdate.ParamByName('dwmc').Value:=DM1.ADOQuery1.FieldByname('dwmc').Value;
DM1.IBupdate.ParamByName('gxry').Value:=DM1.ADOQuery1.FieldByname('gxry').Value;
DM1.IBupdate.ParamByName('kxlb').Value:=DM1.ADOQuery1.FieldByname('kxlb').Value;
DM1.IBupdate.ParamByName('jsdw').Value:=DM1.ADOQuery1.FieldByname('jsdw').Value;
DM1.IBupdate.ParamByName('wlyear').AsSmallInt:=ll;
case i of
1: begin
DM1.IBupdate.ParamByName('fphm').Value:=DM1.ADOQuery1.FieldByname('fphm').Value;
DM1.IBupdate.ParamByName('pm').Value:=DM1.ADOQuery1.FieldByname('pm').Value;
DM1.IBupdate.ParamByName('ph').Value:=DM1.ADOQuery1.FieldByname('ph').Value;
DM1.IBupdate.ParamByName('sl').Value:=DM1.ADOQuery1.FieldByname('sl').Value;
DM1.IBupdate.ParamByName('dj').Value:=DM1.ADOQuery1.FieldByname('dj').Value;
DM1.IBupdate.ParamByName('yunfei').Value:=DM1.ADOQuery1.FieldByname('yunfei').Value;
DM1.IBupdate.ParamByName('slf').Value:=DM1.ADOQuery1.FieldByname('slf').Value;
DM1.IBupdate.ParamByName('kpje').Value:=DM1.ADOQuery1.FieldByname('kpje').Value;
DM1.IBupdate.ParamByName('jsfs').Value:=DM1.ADOQuery1.FieldByname('jsfs').Value;
DM1.IBupdate.ParamByName('jslx').Value:=DM1.ADOQuery1.FieldByname('jslx').Value;
DM1.IBupdate.ParamByName('suie').Value:=DM1.ADOQuery1.FieldByname('suie').Value;
DM1.IBupdate.ParamByName('czry').Value:='';
end; // 1
2: begin
DM1.IBupdate.ParamByName('dzje').Value:=DM1.ADOQuery1.FieldByname('dzje').Value;
DM1.IBupdate.ParamByName('jsfs').Value:=DM1.ADOQuery1.FieldByname('jsfs').Value;
DM1.IBupdate.ParamByName('zy').Value:=DM1.ADOQuery1.FieldByname('zy').Value;
end; // 2
3: begin
DM1.IBupdate.ParamByName('zy').Value:=DM1.ADOQuery1.FieldByname('zy').Value;
DM1.IBupdate.ParamByName('js').Value:=DM1.ADOQuery1.FieldByname('js').Value;
DM1.IBupdate.ParamByName('yunfei').Value:=DM1.ADOQuery1.FieldByname('yunfei').Value;
DM1.IBupdate.ParamByName('zf').Value:=DM1.ADOQuery1.FieldByname('zf').Value;
DM1.IBupdate.ParamByName('ddje').Value:=DM1.ADOQuery1.FieldByname('ddje').Value;
end; // 3
4: DM1.IBupdate.ParamByName('jqje').Value:=DM1.ADOQuery1.FieldByname('jqje').Value;
end; //case
DM1.IBupdate.Close;
// if recno>=5447 then showmessage('1- '+inttostr(recno));
Next; // 到第5549条记录时出错:"提供者或其他服务返回E_FAIL状态"
// 更改ADOQuery1.CursorLocation后到第18332条记录时出错
// if recno>=5447 then showmessage('2- '+inttostr(recno));
end; //while
end; //with
DM1.IBTransaction1.Commit;
end; //for
end;
//把AA.dbf的数据转入INTERBASE库中去
procedure TFupdate.B_okClick(Sender: TObject);
var
i, ll, K :integer;
l :string;
begin
ll:=strtoint(Edit1.Text);
l:=Edit1.Text;
l:=copy(l,3,2);
B_ok.Enabled:=False;
B_exit.Enabled:=False;
Edit1.Enabled:=False;
Label2.Caption:='正在更新'+Edit1.Text+'年往来数据......';
Label2.Visible:=True;
Label2.Refresh;
ProgressBar1.Visible:=True;
for i:=1 to 4 do begin
With DM1.ADOQuery1 do begin
Close;
SQL.Clear;
case i of
1: SQL.Add('Select rq,fphm,yxry as gxry,dhdw as dwmc,pm,ph,'+
'kpsl as sl,dj,yunfei,slf,kpje,jsfs,jsdw,jslx,suie,kxlb '+
'from glyk/cwtz'+l+'.dbf');
2: SQL.Add('Select rq,dhdw as dwmc,yxry as gxry,dzje,jsdw,'+
'jsfs,zy,kxlb from glyk/jedz'+l+'.dbf');
3: SQL.Add('Select rq,dddw as dwmc,ddmc as zy,js,yunfei,'+
'zf,ddje,jsdw,yxry as gxry,kxlb from glyk/ddyf'+l+'.dbf');
4: SQL.Add('Select rq,dwmc,gxry,jsdw,kxlb,jqje from bqye.dbf');
end; //case
try
Open;
except
Close;
showmessage('数据更新失败(1-'+inttostr(i)+')!');
exit;
end; //try
end; //with
//DM1.IBupdate (IBQuery)
with DM1.IBupdate do begin
Close;
SQL.Clear;
case i of
1: SQL.Add('insert into wlfp (rq,fphm,gxry,dwmc,pm,ph,sl,dj,'+
'yunfei,slf,kpje,jsfs,jsdw,jslx,suie,kxlb,czry,wlyear)'+
' values rq,:fphm,:gxry,:dwmc,m,h,:sl,:dj,'+
':yunfei,:slf,:kpje,:jsfs,:jsdw,:jslx,:suie,:kxlb,:czry,:wlyear)');
2: SQL.Add('insert into wldz (rq,dwmc,gxry,dzje,jsdw,jsfs,zy,kxlb,wlyear)'+
' values rq,:dwmc,:gxry,:dzje,:jsdw,:jsfs,:zy,:kxlb,:wlyear)');
3: SQL.Add('insert into wlzf (rq,dwmc,zy,js,yunfei,zf,ddje,'+
'jsdw,gxry,kxlb,wlyear) values rq,:dwmc,:zy,:js,'+
':yunfei,:zf,:ddje,:jsdw,:gxry,:kxlb,:wlyear)');
4: SQL.Add('insert into wlbqye (rq,dwmc,gxry,jsdw,kxlb,jqje)'+
' values rq,:dwmc,:gxry,:jsdw,:kxlb,:jqje)');
end; //case
end; //with
with DM1.IBQuery1 do begin
Close;
SQL.Clear;
case i of
1: SQL.Add('Delete from wlfp where wlyear='+Edit1.Text);
2: SQL.Add('Delete from wldz where wlyear='+Edit1.Text);
3: SQL.Add('Delete from wlzf where wlyear='+Edit1.Text);
4: SQL.Add('Delete from wlbqye');
end; //case
DM1.IBTransaction1.StartTransaction;
try
ExecSQL;
DM1.IBTransaction1.Commit;
Close;
except
DM1.IBTransaction1.Rollback;
Close;
messagebeep(0);
showmessage('删除数据失败(2-'+inttostr(i)+')!');
exit;
end; //try
end; //with
with DM1.ADOQuery1 do begin
K:=0;
while not Eof do begin
DM1.IBupdate.ExecSQL;
DM1.IBupdate.ParamByName('rq').AsDate:=DM1.ADOQuery1.FieldByname('rq').Value;
DM1.IBupdate.ParamByName('dwmc').Value:=DM1.ADOQuery1.FieldByname('dwmc').Value;
DM1.IBupdate.ParamByName('gxry').Value:=DM1.ADOQuery1.FieldByname('gxry').Value;
DM1.IBupdate.ParamByName('kxlb').Value:=DM1.ADOQuery1.FieldByname('kxlb').Value;
DM1.IBupdate.ParamByName('jsdw').Value:=DM1.ADOQuery1.FieldByname('jsdw').Value;
DM1.IBupdate.ParamByName('wlyear').AsSmallInt:=ll;
case i of
1: begin
DM1.IBupdate.ParamByName('fphm').Value:=DM1.ADOQuery1.FieldByname('fphm').Value;
DM1.IBupdate.ParamByName('pm').Value:=DM1.ADOQuery1.FieldByname('pm').Value;
DM1.IBupdate.ParamByName('ph').Value:=DM1.ADOQuery1.FieldByname('ph').Value;
DM1.IBupdate.ParamByName('sl').Value:=DM1.ADOQuery1.FieldByname('sl').Value;
DM1.IBupdate.ParamByName('dj').Value:=DM1.ADOQuery1.FieldByname('dj').Value;
DM1.IBupdate.ParamByName('yunfei').Value:=DM1.ADOQuery1.FieldByname('yunfei').Value;
DM1.IBupdate.ParamByName('slf').Value:=DM1.ADOQuery1.FieldByname('slf').Value;
DM1.IBupdate.ParamByName('kpje').Value:=DM1.ADOQuery1.FieldByname('kpje').Value;
DM1.IBupdate.ParamByName('jsfs').Value:=DM1.ADOQuery1.FieldByname('jsfs').Value;
DM1.IBupdate.ParamByName('jslx').Value:=DM1.ADOQuery1.FieldByname('jslx').Value;
DM1.IBupdate.ParamByName('suie').Value:=DM1.ADOQuery1.FieldByname('suie').Value;
DM1.IBupdate.ParamByName('czry').Value:='';
end; // 1
2: begin
DM1.IBupdate.ParamByName('dzje').Value:=DM1.ADOQuery1.FieldByname('dzje').Value;
DM1.IBupdate.ParamByName('jsfs').Value:=DM1.ADOQuery1.FieldByname('jsfs').Value;
DM1.IBupdate.ParamByName('zy').Value:=DM1.ADOQuery1.FieldByname('zy').Value;
end; // 2
3: begin
DM1.IBupdate.ParamByName('zy').Value:=DM1.ADOQuery1.FieldByname('zy').Value;
DM1.IBupdate.ParamByName('js').Value:=DM1.ADOQuery1.FieldByname('js').Value;
DM1.IBupdate.ParamByName('yunfei').Value:=DM1.ADOQuery1.FieldByname('yunfei').Value;
DM1.IBupdate.ParamByName('zf').Value:=DM1.ADOQuery1.FieldByname('zf').Value;
DM1.IBupdate.ParamByName('ddje').Value:=DM1.ADOQuery1.FieldByname('ddje').Value;
end; // 3
4: DM1.IBupdate.ParamByName('jqje').Value:=DM1.ADOQuery1.FieldByname('jqje').Value;
end; //case
DM1.IBupdate.Close;
// if recno>=5447 then showmessage('1- '+inttostr(recno));
Next; // 到第5549条记录时出错:"提供者或其他服务返回E_FAIL状态"
// 更改ADOQuery1.CursorLocation后到第18332条记录时出错
// if recno>=5447 then showmessage('2- '+inttostr(recno));
end; //while
end; //with
DM1.IBTransaction1.Commit;
end; //for
end;