Board index » delphi » EDatabaseError and TTable.Post

EDatabaseError and TTable.Post

Does anyone know why TTable.POST insists on generating its own
exception message, even if I put it in my own exception handler?
Instead of using the DBNavigator to do a post, I have the following in
a button to do a post:

begin
    try
        Table1.Post;
    except
        on E : EDatabaseError do ShowMessage(E.Message);
    end;
end;

Delphi tries the post, then sends up an exception message, then it goes
to my exception and shows the one I set up.  Anyone know this is
happening?

THanks for any info.

 

Re:EDatabaseError and TTable.Post


Give this a try. Run it outside of the Delphi Environment and see what happens:
begin
     try
        Table1.Post;
     except
       on E1: EDatabaseError do
          MessageDlg('Database Error: ' + E1.Message, mtInformation, [mbOk], 0);
       on E2: EDBEngineError do
          MessageDlg('Database Engine Error: ' + E2.Message, mtInformation,    
        [mbOk], 0);
     end;
end;
Quote
> Does anyone know why TTable.POST insists on generating its own
> exception message, even if I put it in my own exception handler?
> Instead of using the DBNavigator to do a post, I have the following in
> a button to do a post:

> begin
>     try
>         Table1.Post;
>     except
>         on E : EDatabaseError do ShowMessage(E.Message);
>     end;
> end;

> Delphi tries the post, then sends up an exception message, then it goes
> to my exception and shows the one I set up.  Anyone know this is
> happening?

> THanks for any info.

Re:EDatabaseError and TTable.Post


On 7 Dec 1995 16:07:28 GMT, s...@ix.netcom.com (Sharon Ball ) wrote:

Quote
>Does anyone know why TTable.POST insists on generating its own
>exception message, even if I put it in my own exception handler?
>Instead of using the DBNavigator to do a post, I have the following in
>a button to do a post:

>begin
>    try
>        Table1.Post;
>    except
>        on E : EDatabaseError do ShowMessage(E.Message);
>    end;
>end;

>Delphi tries the post, then sends up an exception message, then it goes
>to my exception and shows the one I set up.  Anyone know this is
>happening?

Does this just happen when running the application from the IDE, and not
when running the EXE by external means? If so, you may just need to change
a setting. Select from the IDE menu Options|Project. In the Project Options
dialog, on the Preferences tab page, in the Debugging group box, uncheck
the Break On Exception checkbox.

**************************************************************************
Steve Koterski
Product Group Manager
Delphi Technical Support
Borland International, Inc.

Re:EDatabaseError and TTable.Post


Try turning off Delphi's generation of exceptions in the options
section. Look under the Options menu item, in Environment... and on
the Preferences page. Turn off the Break on Exception item. Now
compile and run the program. You should only get your own exceptions.
Remember to to turn this back on once you have tested your exception
handler.

Quote
>Does anyone know why TTable.POST insists on generating its own
>exception message, even if I put it in my own exception handler?
>Instead of using the DBNavigator to do a post, I have the following in
>a button to do a post:

>begin
>    try
>        Table1.Post;
>    except
>        on E : EDatabaseError do ShowMessage(E.Message);
>    end;
>end;

>Delphi tries the post, then sends up an exception message, then it goes
>to my exception and shows the one I set up.  Anyone know this is
>happening?

>THanks for any info.

Fred Legace - Winnipeg, MB  Canada

Internet Association of Manitoba. Visit our home
page at: http://www.mbnet.mb.ca/iweave/IAM

Other Threads