数据库编程:检测TabName 数据表是否存在

Function AccisTable_exist(AdoCON:TADOConnection; tabname:string):boolean;
//检测 TabName 数据表是否存在
var
  index : integer;
  SL    : TStringList;
begin
  result:=false;
  SL := TStringList.Create;
  try
    ADOCon.GetTableNames(SL,False);
  except
    raise Exception.Create('装载源库列表错误!错误特征码2003');
  end;
  for index := 0 to (SL.Count - 1) do
    if  SL[index]=tabname then result:=true;
  SL.free;
end;

posted on 2011-08-14 14:42  dps  阅读(208)  评论(0编辑  收藏  举报

导航