I am getting a weird error which occurs only when using UK Database but not other databases.
Error is as follows:
"Object reference not set to an instance of an object"
Below is the error line in <u><b>BOLD</b></u>
Private Sub SingleSignOn()
Try
oCompany = New SAPbobsCOM.Company
sCookie = oCompany.GetContextCookie
sConnectionContext = SBO_Application.Company.GetConnectionContext(sCookie) 'GET COOKIE FROM UI
If oCompany.Connected = True Then
oCompany.Disconnect()
End If
sConnectionContext = oCompany.SetSboLoginContext(sConnectionContext) 'SET COOKIE TO DI
<b><u>lRetCode = oCompany.Connect</u></b> 'line error
If oCompany.Connected = True Then
'SBO_Application.MessageBox("Connected via SingleSignOn")
End If
Catch ex As Exception
SBO_Application.MessageBox(ex.Message)
MsgBox(ex.Message + vbCrLf + ex.StackTrace, MsgBoxStyle.Critical, "SBO BAPI ERROR")
End Try
End Sub