Plus Community - for users of ACCPAC & Adagio accounting software

Welcome to the PlusCommunity forums! PlusCommunity is a gathering place for companies running Simply Accounting, ACCPAC Plus, Sage Accpac ERP (ACCPAC Advantage/ACCPAC for Windows), and Adagio Accounting.
New visitors, please click here!

Page 1 of 1 1
Topic Options
#53962 - 05/14/19 01:09 PM C# error when inserting OE Order

Registered: 11/21/03
Posts: 63
Loc: Canada
Hi All;

I have a fairly sophisticated C# program that processes a CSV file, does a lot of pre-checks and if all is good, creates an OE Order and creates the Shipment. The program has been working for a while now and does what we needed. Occasionally, the following code generates the message "Error HRESULT E_FAIL has returned from a call to a COM component. O/E Options. Record has been modified by another program." I have not been able to determine why this occurs. We run this program both from the Windows Task Scheduler and from Sage directly. The error can come from both scenarios. If we reprocess the CSV file as is (i.e. no changes), it works.

Here is a snippet of the code:

if (OEORD1header.LastReturnCode == 0 || OEORD1header.LastReturnCode == 6666)
catch (Exception ex)
sSubject = "SFA import - Failed to Post Order using command OEORD1Header.Insert()";
"ex.message - " + ex.Message;

Any idea why this message will occur?

Do I need to build some record locking? If so, I any examples would be welcome.



#53963 - 05/14/19 01:15 PM Re: C# error when inserting OE Order [Re: S.Herlick]
Jay Converse Administrator

Registered: 07/31/00
Posts: 7727
Loc: Location, Location
In 20 years of Sage programming, I've never looked at .LastReturnCode. Get your messages by browsing the Session Errors object when catch your exception.

Your "record has been modified error" is probably caused by either sloppy code, such as multiple views updating the same order, or external processes updating your order.
Jay Converse
Sage 300 Whisperer

Page 1 of 1 1

Moderator:  Jay Converse 
Hop to: