SAP DI API Connection

public static SAPbobsCOM.Company connect() { SAPbobsCOM.Company sapCompany = new SAPbobsCOM.Company(); try { sapCompany.CompanyDB = "<companydb>"; sapCompany.Server = "<servername>"; //sapCompany.LicenseServer = "<licenseserver>"; //sapCompany.SLDServer = "<sldserver>"; sapCompany.DbUserName = "<sqldbusername>"; sapCompany.DbPassword = "<sqldbpassword>"; sapCompany.UserName = "<accountusername"; sapCompany.Password = "<accountpassword>"; sapCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2012; sapCompany.UseTrusted = false; int returnValue = sapCompany.Connect(); string errorMessage = sapCompany.GetLastErrorDescription(); int errorNumber = sapCompany.GetLastErrorCode(); if(errorNumber != 0) { Console.WriteLine(errorMessage); } else { Console.WriteLine("success Connected"); return sapCompany; } } catch (Exception ex) { Console.WriteLine("oops something went wrong: " + ex.Message); } return null; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.