cancel
Showing results for 
Search instead for 
Did you mean: 

DI api application crashes on client

levinefinger
Explorer
0 Kudos
283

Hello, everyone,

I have a problem with the DI API.

I created an add-one in Visual Studio using C#. When debugging and when publishing the application on my PC, the program works perfectly.

However, if I install the program on a client, the program crashes when posting a transaction.

The eventviewer on the client says there is a problem with the System.Runtime.InteropService.COMException.

I suspect that the program crashes when creating the APIConnection class...

 internal class SapApiConnection
    {
        private SAPbobsCOM.Company company = new SAPbobsCOM.Company(); // I think the application crashes here on the client
        private int connectionResult;
        private int errorCode = 0;
        private string errorMessage = "";

        public int Connect()
        {
           
            company.Server = "##########";
            company.CompanyDB = "##########";
            company.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2016;
            company.DbUserName = "#######";
            company.DbPassword = "########";
            company.UserName = "########";
            company.Password = "########";
            company.language = SAPbobsCOM.BoSuppLangs.ln_German;
            company.UseTrusted = false;
            company.LicenseServer = "###########";

            connectionResult = company.Connect();

            if (connectionResult != 0)
            {
                company.GetLastError(out errorCode, out errorMessage);
            }

            return connectionResult;
        }
      
        public SAPbobsCOM.Company GetCompany()
        {
            return this.company;
        }

      
        public int GetErrorCode()
        {
            return this.errorCode;
        }


        public String GetErrorMessage()
        {
            return this.errorMessage;
        }
    }

I also installed the SAP Business One DI API on the client.

We use the version sap b1 9.3. In visual studio I use the dll version 9.0, does that fit?

Thank you very much for your help 🙂

Best regards

Levin

Accepted Solutions (1)

Accepted Solutions (1)

Johan_Hakkesteegt
Active Contributor
0 Kudos

Hi Levin,

The DI API version must match the system version. The necessary DI API version is usually included in the installation package.

Regards,

Johan

levinefinger
Explorer

Hey Johan,

Thank you for your message.

The problem was the system. I installed the 32-bit version of DI-API. After that it worked until I got the next error message:

wrong server type

I installed the SAP client. After that the application worked perfectly.

But why I now had to install the SAP client is not entirely clear to me

Regards,

Levin

Johan_Hakkesteegt
Active Contributor
0 Kudos

When you install the client from the shared folder, you get the version corresponding to the system version. The client installation in turn includes the installation of the correct DI API (bit)version.

So although it was not technically necessary to install the client, it does do the trick.

Regards,

Johan

Answers (0)