cancel
Showing results for 
Search instead for 
Did you mean: 

Why we need to install x86 DIAPI for x64 solution

0 Kudos

Hi Experts:

I have question about the DIAPI Installation.

If we need to use x64 bit DIAPI in our .net solution, do we need to install the x86 DIAPI into the machine as well?

We always get this exception when we run the x64 solution on the machine which only install the x64 DIAPI.

Unhandled Exception: System.InvalidCastExcetion: Unable to cast COM object of type 'System.__Comobject' to interface type 'SAPbobsCOM.Company'.

The problem will disappear when we install the x86 DIAPI.

Does that mean we need to install x86 DIAPI no matter the CPU type we selected?

I will attach our testing code. I have build the program as x64 and referenced x64 bit DIAPI

 class Program
    {
        static void Main(string[] args)
        {
            SAPbobsCOM.Company company = new SAPbobsCOM.Company();        
            company.UserName = "manager";
            company.Password = "manager";
            company.CompanyDB = "SBODEMOUS";
            company.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_HANADB;
            company.SLDServer = "10.179.1.41:40000";
            company.Server = "10.179.1.41:30015";

            int lRetCode = company.Connect();
            if (lRetCode != 0) // if the connection failed
                Console.WriteLine(company.GetLastErrorDescription());
            else
                Console.WriteLine("Connection opened");
            Console.Read();
        }
    }
// Error occurred when program started.

Thanks

Jeanne

Accepted Solutions (0)

Answers (0)