使用DI API将Sap B1 hana与C#应用程序连接

时间:2018-09-06 11:50:26

标签: c# sap hana sapb1

我正在尝试使用DI API在C#基于Web的应用程序上连接MY Sap B1 HANA,但我的连接给我错误。这是错误截图Failed to Connect SLD,make Sure Your SLD Server is Available and Connected。任何相关的帮助将不胜感激。

          try{

            oCompany.CompanyDB = "***";
            oCompany.Server = "***";
            oCompany.LicenseServer = "***:30015";

            oCompany.SLDServer = "***:40000";     //  
            oCompany.DbUserName = "****"; // 
            oCompany.DbPassword = "****"; //
            oCompany.UserName = "****"; //
            oCompany.Password = "****"; // 
            oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_HANADB;
            oCompany.UseTrusted = false;
            int res = oCompany.Connect();
            string errMsg = oCompany.GetLastErrorDescription();
            int ErrNo = oCompany.GetLastErrorCode();
            if (ErrNo != 0)
            {
                value1 = errMsg;
                return errMsg;
            }
            else {
                value1 = "Succes Connection To Sap B1 Hana";
                return value1;

            }

2 个答案:

答案 0 :(得分:1)

您必须在服务器中包含端口号。通常,端口号是30015。

答案 1 :(得分:0)

您还可以使用以下提及的代码。

SAPbobsCOM.Company oCompany = new SAPbobsCOM.Company();
oCompany = (SAPbobsCOM.Company)Application.SBO_Application.Company.GetDICompany();