function TForm1.TableExists(TableName: String): Boolean;
var TableList:TstringList;
begin
TableList:=Tstringlist.Create;
ADOConnection1.GetTableNames(TableList);
if TableList.IndexOf(TableName) >= 0 then //如果表不存在
Result := True
else Result := False;
end;
var TableList:TstringList;
begin
TableList:=Tstringlist.Create;
ADOConnection1.GetTableNames(TableList);
if TableList.IndexOf(TableName) >= 0 then //如果表不存在
Result := True
else Result := False;
end;
var TableList:TstringList;
begin
TableList:=Tstringlist.Create;
TRY
ADOConnection1.GetTableNames(TableList);
if TableList.IndexOf(ADOTABLE1.TableName) >= 0 then
SHOWMESSAGE('该表存在') else SHOWMESSAGE('该表不存在');
FINALLY
TableList.Free;
END;
end;