Suppressing Error Messages of an Automation object

clocx
clocx Member Posts: 12
I've created a CodeUnit that is part of a scheduled nightrun (not NAS).
This CodeUnit uses an ADO Automation object that connects to a SQL Server. The CodeUnit runs fine, but when for example the SQL Server is not running an error message is fired from the connection.open. Unfortunately this message comes with an OK button.
This will suspend the rest of the execution until someone hits the OK button.
In other languages you can program TRY en Catch or OnError triggers.
Does anybody have a solution in Navision for my problem?

Thanx

Comments

  • Phenno
    Phenno Member Posts: 630
    clocx wrote:
    I've created a CodeUnit that is part of a scheduled nightrun (not NAS).
    This CodeUnit uses an ADO Automation object that connects to a SQL Server. The CodeUnit runs fine, but when for example the SQL Server is not running an error message is fired from the connection.open. Unfortunately this message comes with an OK button.
    This will suspend the rest of the execution until someone hits the OK button.
    In other languages you can program TRY en Catch or OnError triggers.
    Does anybody have a solution in Navision for my problem?

    Thanx

    Use codeunit with return value... Boolean := Codeunit.RUN
  • clocx
    clocx Member Posts: 12
    Thank you Phenno,

    I had a separate funcion for the ADOConnection.Open, which I called before RUN, see below

    IF CUExport.OpenConnection(UDLFileName) THEN BEGIN
    IF NOT CUExport.RUN THEN
    CUExport.RollBackADOTran();
    CUExport.CloseConnection;
    END;

    I've Integrated the OpenConnection in the RUN-Trigger and indeed the message is suppressed.

    Your reply has helped me a lot.
    Again Thank you.
  • Phenno
    Phenno Member Posts: 630
    np.

    please, add [Solved] to title of this thread if you think your problem is solved.