Delphi Examples: DbiGetErrorContext

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Delphi Examples: DbiGetErrorContext

Return to chapter overview

Show error context string.

After a dbi function returns an error, you can use this procedure to display the error context string associated with the context type specified in eContext. This example uses the following input:

 ShowErrorContext(ecTABLENAME);

 

The procedure is defined as:

procedure ShowErrorContext(eContext: Integer);

var

 Ctxt: String;

begin

 SetLength(Ctxt, DBIMAXMSGLEN);

 DbiGetErrorContext(eContext, PChar(Ctxt));

 SetLength(Ctxt, StrLen(PChar(Ctxt)));

if (Ctxt > '') then

   ShowMessage(format('Error context string: %s',[Ctxt]));

end;