YOUSEFUL / DELPHI / COMPONENTS
EAtlasDatabaseError
The exception the Atlas Info controls and filter raise when they refuse an operation.
Description
Declared in Atlas.DBControls as an Exception descendant with no members of its own; Atlas.DBFilter raises it too. It reports:
- no active data source or dataset;
- read-only, required, oversize or out-of-range values, and field types
EditValuedoes not handle; - exporting, filtering or clearing a filter while a record is being edited;
- lookup keys that do not exist, and lookup datasets that are not browsing;
- RTF in a field that is not a blob or memo field, and font sizes outside 1..512;
- row heights outside 18..120;
- filter ownership conflicts.
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.
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;Related
TAtlasDBGrid · TAtlasDBLookupCombo · TAtlasDBRichEdit · TAtlasDataFilter
Also in Atlas Info
TAtlasDBGrid · TAtlasDBLookupCombo · TAtlasDBRichEdit · TAtlasDataFilter · TAtlasFilterEdit