Hello Experts,
I want to connect SAP B1 through Visual studio.
i have seen below coding in many places and tried the same for my connection but i am failed each time to connect. Sometime shows error 111 (Unable to access common database) occurred.
Please Suggest me How i can connect.
oCompany = New SAPbobsCOM.Company
oCompany.Server = "sapsrv”
oCompany.CompanyDB = "SBODemo_UK"
oCompany.UserName = "manager"
oCompany.Password = "B1Admin”
oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2014
oCompany.DbUserName = "sa"
oCompany.DbPassword = "sapass"
oCompany.LicenseServer = "sapsrv:30000”
retVal = oCompany.Connect
If retVal <> 0 Then
oCompany.GetLastError(retVal, retStr)
MsgBox("Error " & retVal & " " & retStr)
Else
MsgBox("Connected to " & oCompany.CompanyName)
End If