Skip to Content
avatar image
Former Member

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

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!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 06, 2017 at 10:45 PM

    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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 07, 2017 at 04:49 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded