Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Access Protected Memory Error in Company.Connect in SAP Business One 8.81

Hi All,

i got an annoying problem in my addon connecting to SAP B1 8.81.

It randomly happens that when i try to connect to company, i got an access violation error.

I'm trying to connect to SAP B1 8.81 PL05.

THis is My Code:

Private Function ConnectToCompany() As Integer

'// Establish the connection to the company database.

Dim iConnect As Integer


iConnect = oCompany.Connect

Return iConnect

Catch ex As AccessViolationException

Dim sBuffer As String = ""

sBuffer = oCompany.GetLastErrorDescription

MsgBox(ex.Message & vbCrLf & "Source: " & ex.Source & vbCrLf & "StackTrace: " & ex.StackTrace)

Return -1

End Try

End Function

The GetLastErrorDEscription is empty and the connect returns me 0 (connection OK) but it's not true because just while connecting and assigning return value to my variable, i got the exception and after that the addon results not connected to the company even if the results of the connect seems to be 0 according to the getlasterrordescription that is empty.

I'm using as connection string the development connection string (0030002C0030002C00530041005000420044005F00440061007400650076002C0050004C006F006D0056004900490056)

What could be the problem? DI API bug?...DB Installation?

Thanks in advance.

Edited by: Nicola Piccone on May 21, 2011 2:11 PM

Former Member
Not what you were looking for? View more on this topic or Ask a question