Error – Company database link Exception occurred in Sage 300 using COMAPI

By | February 28, 2020

We are aware that Sage 300 SDK provides capabilities to import the data using an external utility created in different programming languages like VB6.0, C#, etc. During development of such utility programmer may come across situation where they encounter errors on Insert/Update operations.

So, in this blog, we will discuss about how to handle an exception occurred while importing the data into the Sage 300 Common Services module.

New Stuff: Change session date in sage 300C

In today’s blog we will see one of the possible cause of the error “Cannot write to system database tables or originate propagation using a company database link. Use a system database link instead.” and probable solution to the error.

One solution can be that the program requires connection to the system database link instead of company database link. It becomes difficult to identify the cause of the exception as it occurs while inserting/updating the data into sage 300 using COMAPI.

Using Company DBLink

mDBLinkCmpRW=accpacsession.OpenDBLink(AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_COMPANY, AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE);

When the user using the company object to import the data into sage 300, the user can get an error on the below line of code:

CSRATES1detail.Insert();
CSRATES1detail.Update();

Using System DBLink

System database link instead of the company database will be required to use the Sage 300 object in-order to resolve the above mentioned error.

mDBLinkCmpRW=accpacsession.OpenDBLink(AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_SYSTEM, AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE);

This can be helpful for the developer to quickly overcome the error and proceed further with the development.

About Us

Greytrix a globally recognized Premier Sage Gold Development Partner is a one stop solution provider for Sage ERP and Sage CRM needs. Being recognized and rewarded for multi-man years of experience, we bring complete end-to-end assistance for your technical consultations, product customizations, data migration, system integrations, third party add-on development and implementation expertise.

Greytrix helps in Sage ERP and CRM upgrades to the latest version and migration for Sage Intacct from Sage 300, Sage 100, Sage 50 and QuickBooks; for Sage 100, Sage 300 (Sage Accpac), Sage Enterprise Management (Sage X3) from Sage Pro, Sage 50 US, Sage 50 CA, Sage 50 Usage Business Works, Sage Business Vision and QuickBooks; for Sage CRM from Salesforce | ACT! | SalesLogix | Goldmine | Sugar CRM | Maximizer

For more information on Sage ERP – CRM migration solutions, please contact us at erpmig@greytrix.com. We will be glad to assist you.