Board index » delphi » Customizing MS SQL Error Messages!

Customizing MS SQL Error Messages!

 Hi,
1) How can i Customize or Capture a MS SQL 6.5 Error Message (Ej. Key
Violation, Referential Integrity Messages, etc.). I'm developing a system in
spanish so this is an important issue.

PH: i'm using Delphi 3 C/S and MSSQL65

Thanks in Advance.

Nicolas Marquevich
nmarq...@iname.com

 

Re:Customizing MS SQL Error Messages!


Nicolas,

Use a try-except block on individual table or query operations.

try
  query1.open;
except
  on e: edbengineError do
  begin
    if Pos('COLUMN REFERENCE CONSTRAINT', AnsiUpperCase(E.Message)) <> 0
then
    begin
      MessageDlg('Dude, this record is linked to from other tables!  I can't
delete it!',
        mtInformation, [mbOK, mbHelp], -1);
    end
    else
      application.showException(e);
  end;
end;

To do an application-wide capture, I use an ApplicationException function
attached to my main form, then in the create, I do:
Application.OnException := ApplicationException;

The ApplicationException looks like this in the form's private section:
    procedure ApplicationException(Sender: TObject; E: Exception);

Quote
Nicolas Marquevich wrote in message <6boeb6$di...@forums.borland.com>...
> Hi,
>1) How can i Customize or Capture a MS SQL 6.5 Error Message (Ej. Key
>Violation, Referential Integrity Messages, etc.). I'm developing a system
in
>spanish so this is an important issue.

>PH: i'm using Delphi 3 C/S and MSSQL65

>Thanks in Advance.

>Nicolas Marquevich
>nmarq...@iname.com

Other Threads