Skip to Content
0
Former Member
Dec 06, 2006 at 08:50 PM

Connection Error

52 Views

Hi all,

I´m getting an unexpected error for the connection sign on. Unexpected because it was working just fine, and after using some windows tools (Defrag, scandisk), my add-on wasn´t able to connect anymore.

I´m getting the error message "the field is too small to accept the data" on the following line:

SetConnectionContext = oCompany.SetSboLoginContext(sConnectionContext)

I think its has something to do with the string sConnectionContext, but it'd been given by the system by SBO_Application.Company.GetConnectionContext(sCookie).

Does anybody knows what it is about ?

Thanks in advance.

Pegorer.

Here is the code:

Private Function SetConnectionContext() As Integer

Dim sCookie As String

Dim sConnectionContext As String

'// First initialize the Company object

oCompany = New SAPbobsCOM.Company

'// Acquire the connection context cookie from the DI API.

sCookie = oCompany.GetContextCookie

'// Retrieve the connection context string from the UI API using the

'// acquired cookie.

sConnectionContext = SBO_Application.Company.GetConnectionContext(sCookie)

'// before setting the SBO Login Context make sure the company is not

'// connected

If oCompany.Connected = True Then

oCompany.Disconnect()

End If

'// Set the connection context information to the DI API.

Try

SetConnectionContext = oCompany.SetSboLoginContext(sConnectionContext)

Catch ex As Exception

SBO_Application.MessageBox(ex.Message.ToString)

End Try

End Function