cancel
Showing results for 
Search instead for 
Did you mean: 

Is it better to keep a Company.Connect() open or should I use one per transaction?

Former Member
0 Kudos

Performancewise and resourcewise, what's better?

Right now, I open and close the connection every time I want to post a transaction (like an object.update or object.add) but I am not really sure if this is considered a bad practice. I do it this way because I don't like to keep a connection open while the add-on is alive... but I want to know which one is considered a best practice

Company.Connect() at the start of the Add-On and Company.Disconnect() before closing it

vs

Companny.Connect() <DoSomething> Company.Disconnect()

I hope you guys and gals can enlight me

EDIT

I am using SAP Business One 9.1 over SQL Server 2012.

Accepted Solutions (1)

Accepted Solutions (1)

edy_simon
Active Contributor
0 Kudos

Hi Hector,

Connecting to SBO has a very high overhead.

I would keep the connection open through all the session.

If you addon is connected to a running SBO, you can use the company connection of the SBO addon instead of connecting your self.

oCompany =  SBOApplication.Company.GetDICompany as SAPbobsCOM.Company;

Regards

Edy

Answers (0)