Skip to Content
0
Former Member
Aug 09, 2016 at 01:02 AM

connect DI API To SAP Business one from c# application failed

1789 Views

** i tried to connect Di Api to SAP Busiess one client from c# application to server online..

the return value is (-111)..

while use this is code:

public ConnectToSap(string server, string Ser_Password, string companyDB, string userName, string password, string DbUserName, string DbPassword, string LicensServer)

{

this.server = server;

this.Ser_Pass = Ser_Password;

this.companyDB = companyDB;

this.userName = userName;

this.password = password;

this.DbUserName = DbUserName;

this.DbPassword = DbPassword;

this.LicensServer = LicensServer;

}

public int connect()

{

SAPbobsCOM.Company companyObject = new SAPbobsCOM.Company();

companyObject.Server = this.server;

companyObject.Password = this.Ser_Pass;

companyObject.CompanyDB = this.companyDB;

companyObject.UserName = this.userName;

companyObject.Password = this.password;

companyObject.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_DB_2;

companyObject.DbUserName = this.DbUserName;

companyObject.DbPassword = this.DbPassword;

companyObject.LicenseServer = this.LicensServer;

companyObject.UseTrusted = false;

this. ErrorMessage = companyObject.GetLastErrorDescription();

string Error = companyObject.GetLastErrorDescription();

int checkConnection = -1;

checkConnection = companyObject.Connect();

return checkConnection;

}

please could anyone help me >>

thanks regrds.