cancel
Showing results for 
Search instead for 
Did you mean: 

How to Reuse a SAPbobsCOM.Company connection again and again?

Former Member
0 Kudos

I'd like to test speeds while reusing the same connection for multiple tasks (oInventoryGenExit , oInventoryGenEntry, etc.. ) compared to establishing the connection per task and disconnecting upon success..

SAPbobsCOM.Company Vcmp = new SAPbobsCOM.Company();

Vcmp.Server = "local";

Vcmp.CompanyDB = "TestDB";

Vcmp.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2012;

Vcmp.DbUserName = "manger";

Vcmp.DbPassword = "password";

Vcmp.UserName = "manager";

Vcmp.Password = "password";

Vcmp.language = SAPbobsCOM.BoSuppLangs.ln_English;

Vcmp.LicenseServer = "0.0.0.0:30000";

Vcmp.UseTrusted = false;

int connected = Vcmp.Connect();

SAPbobsCOM.Documents oGoodsIssue = (SAPbobsCOM.Documents)Vcmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oInventoryGenExit);

...and so on..

note: I'm not disconnecting Vcmp at any point.

Everything works well the first attempt but I'm stuck trying to find/reference this active connection for subsequent tasks.. \

Is this possible? any sample code out there?

Thanks guys!

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member185682
Active Contributor

Hi Steve,

You can create your company object as static and use it where you want in your project, and just close it when you finish all your tasks.

Hope it helps.

Kind Regards,

Diego Lother

Former Member
0 Kudos

Food for thought, I'm exploring that option. Thanks Diego,

To explain further, I have a web app (MVC) on Ipads which many ppl use simultaneously to update SAP.. My fantasy was that SAPbobscom exposed an existing open connection that i could use.