如题

解决方案 »

  1.   

    function TDM.MyTableExists(ATableName: String): Boolean;  //判断给定表是否存在
    var
      SL: TStrings;
      I: Integer;
      S: String;
    begin
      Result := False;
      S := UpperCase(ATableName);
      SL := TStringList.Create;
      try
        DM.ADOConnection.GetTableNames(SL, False); //取得表名
        for I := 0 to (SL.Count - 1) do
        begin
          if UpperCase(SL[I])= S then
          begin
            Result := True;
            Break;
          end;{if}
        end;{for}
      finally
        SL.Free;
      end;{try}
    end;调用:
     if  MyTableExists('ATableName') then ShowMessage('已存在');
      

  2.   

    http://community.csdn.net/Expert/TopicView3.asp?id=4924742
    http://community.csdn.net/Expert/TopicView3.asp?id=4922716
    看看這里一個是庫,,一個是表