Skip to Content
Former Member
May 10, 2011 at 11:55 AM

Company connection


Hi xperts,

I got this code in tutorial, but how to run it in Visual Basic means stepwise how projects need to be created and etc?

Dim oCompany As SAPbobsCOM.Company

Dim lRetCode, lErrCode As Long

Dim sErrMsg as String

'Instanciate a Company object

oCompany = New SAPBobsCOM.Company

oCompany.Server = "(local)"

oCompany.CompanyDB = "SBODemo_US"

oCompany.UserName = "manager"

oCompany.Password = "manager"

oCompany.Language = ln_English

u2018Sample: E.g.use Windows Auth.(MSSQL only)

oCompany.UseTrusted = True

u2018Set AddOn identifier u2013 a long string with numbers; identifies

u2018your Add-On against License Service u2026 optional!

u2018oCompany.AddOnIdentifier = u201Cfill in your Add-On Identifier hereu201D

lRetCode = oCompany.Connect()

'Check Return Code

If lRetCode 0 Then

oCompany.GetLastError(lErrCode, sErrMsg)

End If