YOUSEFUL / DELPHI / COMPONENTS

EAtlasDatabaseError

The exception the Atlas Info controls and filter raise when they refuse an operation.

Class Unit Atlas.DBControls · Inherits Exception · Product Atlas Info

Description

Declared in Atlas.DBControls as an Exception descendant with no members of its own; Atlas.DBFilter raises it too. It reports:

Some errors come from other units and are not EAtlasDatabaseError: invalid numbers, Booleans and dates in EditValue raise EAtlasDataError (Atlas VCL, Atlas.Data); an unknown field name raises EDatabaseError (Data.DB); bytes that are not RTF raise EArgumentException; a rich edit without a parent window raises EInvalidOperation. Catch Exception to handle all of them.

This type has no members of its own beyond those listed in its description.

Examples

Export only when no edit is pending

Returns False, with the message Post or cancel before exporting, while the grid's dataset is in edit state.

pascal
uses System.SysUtils, Atlas.DBControls;

function ExportIfBrowsing(Grid: TAtlasDBGrid; out CSV: string): Boolean;
begin
  try
    CSV := Grid.ExportCSV;
    Result := True;
  except
    on E: EAtlasDatabaseError do
    begin
      Writeln('Not exported: ', E.Message);  // for example "Post or cancel before exporting"
      Result := False;
    end;
  end;
end;

TAtlasDBGrid · TAtlasDBLookupCombo · TAtlasDBRichEdit · TAtlasDataFilter

Also in Atlas Info

TAtlasDBGrid · TAtlasDBLookupCombo · TAtlasDBRichEdit · TAtlasDataFilter · TAtlasFilterEdit