procedure TworkdataintoForm.BitBtn5Click(Sender: TObject);
var tempcursor:Tcursor;
begin
if messagebox(handle,pchar('您真的要把数据转移到备份数据库去吗?请确定'+formatdatetime('yyyy-mm-dd',datetimepicker3.date)+'到'+formatdatetime('yyyy-mm-dd',datetimepicker4.Date)+'这个时间段内的数据暂时不需要用到!'),'提示',mb_iconwarning+4)<>mryes then
exit;
try
tempcursor:=screen.Cursor;
screen.Cursor:=crSqlwait;
begin
with removeQuery do
begin
sql.Clear;
sql.Add('insert into 备份收发表 select * from 收发表');
sql.Add('where (交料日期>=#'+formatdatetime('yyyy-mm-dd',datetimepicker3.Date)+'#)');
sql.Add('and(交料日期<=#'+formatdatetime('yyyy-mm-dd',datetimepicker4.Date)+'#)');
execsql;
//////////////////复制到备份数据库
sql.Clear;
sql.Add('delete * from 收发表');
sql.Add('where (交料日期>=#'+formatdatetime('yyyy-mm-dd',datetimepicker3.Date)+'#)');
sql.Add('and(交料日期<=#'+formatdatetime('yyyy-mm-dd',datetimepicker4.Date)+'#)');
execsql;
end;
end;
with dm1.inandoutSet do
begin
close;
open;
end;
showmessage('数据转移完毕!');
finally
screen.Cursor:=tempcursor;
end;
end;
procedure TworkdataintoForm.BitBtn6Click(Sender: TObject);
var tempcursor:Tcursor;
begin
if messagebox(handle,pchar('您真的从备份数据库中提出'+formatdatetime('yyyy-mm-dd',datetimepicker3.date)+'到'+formatdatetime('yyyy-mm-dd',datetimepicker4.Date)+'这个时间段内的数据吗?'),'提示',mb_iconwarning+4)<>mryes then
exit;
try
tempcursor:=screen.Cursor;
screen.Cursor:=crSqlwait;
begin
with removeQuery do
begin
sql.Clear;
sql.Add('insert into 收发表 select * from 备份收发表');
sql.Add('where (交料日期>=#'+formatdatetime('yyyy-mm-dd',datetimepicker3.Date)+'#)');
sql.Add('and(交料日期<=#'+formatdatetime('yyyy-mm-dd',datetimepicker4.Date)+'#)');
execsql;
//////////////////复制到备份数据库
sql.Clear;
sql.Add('delete * from 备份收发表');
sql.Add('where (交料日期>=#'+formatdatetime('yyyy-mm-dd',datetimepicker3.Date)+'#)');
sql.Add('and(交料日期<=#'+formatdatetime('yyyy-mm-dd',datetimepicker4.Date)+'#)');
execsql;
end;
end;
with dm1.inandoutSet do
begin
close;
open;
end;
showmessage('数据还原完毕!');
finally
screen.Cursor:=tempcursor;
end;