Commit on one table possible???

KeesMeuzelaarKeesMeuzelaar Member Posts: 26
I am creating a log file while working in navision. When an error occurs the system rolls back until the last commit.
I want to keep the logrecords, but i do want to let the system roll back the rest of the transactions.
We are working in navision 4.0 with a 2009 Client and an SQL database.

When i use a commit after insert the logging entry, the system commits the whole process. When i delete the commit, i cannot log my problem.
I can think of a solution like an external log file. But i do not want that, so i hope there is a possibility to partial commit, or skip a table.

I have not heard of something like this, but maybe with the SQl database there are more options.

Comments

  • tinoruijstinoruijs Member Posts: 1,226
    You could create a log.txt and write to that. After each lines save and close the file.
    So when NAV gets an error, the lines in log.txt will still be there.

    Tino Ruijs
    Microsoft Dynamics NAV specialist
  • vaprogvaprog Member Posts: 1,140
    You could try to open a separate connection to the database using ADO or some .NET-equivalent. Then you can handle your commits there yourself. But beware of errors that rob you of the chance to commit it later. Best commit immediately after any complete log entry.

    An alternative might be to use a tool like SQL-Server's bcp.
  • eyolfthoeyolftho Member Posts: 18
    As far as I know G/L entries are written AFTER Sales Invoice Entries during posting...so why not check whether the invoice doc.no exists in G/L?
    If not, it is not completely invoiced yet.

    GenLedEnt.Setrange("Document No.",SalesInv."No.");
    GenLedEnt.Setrange("Posting Date",SalesInv."Posting date");
    If GenLedEnt.isempty then
    -- skip this invoice
  • krikikriki Member, Moderator Posts: 9,112
    Have a singleinstance-codeunit instance and save your logs in a temptable in that singleinstance-codeunit. Those temptable records remain in the temptable even if you have an error. But regularly flush them to database because if your session crashes, you lose them.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.