Recent

Author Topic: trick for catching database errors  (Read 1607 times)

3rdshiftcoder

  • New Member
  • *
  • Posts: 35
trick for catching database errors
« on: December 25, 2020, 10:46:13 am »
HI all-

I am wondering how to catch a more specific database error. I am trying to use firebird but NOT zeos controls. Imagine if I had put an error in my sql property in the editor on purpose. This code works,  but I need the trick to catch db errors.Thanks robo-loki

Here is a sample of the code I run but it is not database specific. I run it with Run->RunWithoutDebugging:

 DataModule3.SQLQuery3.Close;

    try
    // Do something that might go wrong.
    DataModule3.SQLQuery3.Open;
  except on  E:EXCEPTION do
    begin
      // Try to recover or show the user an error message.
        exit;
    end;
  end;                             

3rdshiftcoder

  • New Member
  • *
  • Posts: 35
Re: trick for catching database errors
« Reply #1 on: December 25, 2020, 11:24:20 am »
Hi all-

This link looks promising. Thanks for posting it. robo-loki

https://forum.lazarus.freepascal.org/index.php/topic,38600.msg263018.html#msg263018

 

TinyPortal © 2005-2018