cancel
Showing results for 
Search instead for 
Did you mean: 

Probelm in connect To Company

Former Member
0 Kudos

Hi All,

I am facing a problem when i am connecting to the company.. But it is not happening always.. All of sudden this exception is coming..

the Exception is ,, " Object Reference not set to an instance of an object"

The exception occurs at <b>" oCompany.Connect()[ "</b>

The code is

Private Sub ConnectToCompany()

oCompany = New SAPbobsCOM.Company

oCompany.Server = "90.180.150.115"

'oCompany.CompanyDB = "xenosproduction"

oCompany.CompanyDB = "XenosBB"

oCompany.UserName = "manager"

oCompany.Password = "manager"

oCompany.language = SAPbobsCOM.BoSuppLangs.ln_English

oCompany.DbUserName = "sa"

oCompany.DbPassword = "sapb1@sql"

Try

<b> oCompany.Connect()</b> Catch ex As Exception

MessageBox.Show(ex.Message)

End Try

' Check for errors during connect

oCompany.GetLastError(lErrCode, sErrMsg)

If lErrCode <> 0 Then

MsgBox(sErrMsg)

Else

MsgBox("Connection Established", MsgBoxStyle.Information)

End If

End Sub

Pl help me on this..

Regards

Suresh R

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Suresh,

Everything seems fine in my opinion. Are you sure your SBO version and DI API version is the same?

Hope it helps,

Adele