先检测有无jjk.dbf 再增加字段
procedure TMAINFORM.SpeedButton5Click(Sender: TObject);
var
ap:tStringlist;
ppp:string;
begin
ap:=tstringlist.Create;
session.gettablenames('c:/gzxt','',false,false,ap);
if (ap.indexof('jjk')=-1) then
begin
if application.MessageBox('not exit tsk.dbf','information',mb_okcancel)
=idcancel then
begin
ap.free;
exit;
end;
end
else
begin
if (datam.Table1.FindField('jjs199902'))=nil then
begin
IF (application.messagebox('本月没有计算奖金,计算吗?','消息框',mb_okcancel+mb_defbutton1+mb_iconquestion)
=idok) then
begin
with datam.table1 do
begin
active:=false;
databasename:='c:/gzxt';
tablename:='jjk';
tabletype:=ttdbase;
ppp:='jjs199902';
with fielddefs do
begin
add(ppp,ftstring,20,false);
end;
createtable;
end;
end;
end;
ap.free;
end;
end;