Skip to Content
0
Aug 10, 2016 at 10:03 PM

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

45 Views

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.