My code is as follows,
oComp = new SAPbobsCOM.Company();
oComp.Server = DbServer;
oComp.CompanyDB = "APHS_CONSOLE_LIVE";
oComp.DbUserName = "****";
oComp.DbPassword = "****";
oComp.UserName = "*****";
oComp.Password = "******";
oComp.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2012;
//oComp.UseTrusted = true;
oComp.LicenseServer = "localhost:30000";
oComp.UseTrusted = false;
int temp=-1;
try{
temp= oComp.Connect();
SAPbobsCOM.BoObjectTypes obj=new SAPbobsCOM.BoObjectTypes();
SAPbobsCOM.BusinessPartners oCustomer = oComp.GetBusinessObject(obj); (Line 153)
oCustomer = oComp.GetBusinessObject(obj);
oCustomer.CardCode="8881212";
oCustomer.CardName = "Chaitanya";
oCustomer.Add();
}
catch(Exception e)
{
string error = oComp.GetLastErrorDescription();
xml = finalOutput(temp + " - " + e.ToString() + " - " + error);
return xml;
}
Error :-
-111 - System.Runtime.InteropServices.COMException (0xFFFFFF96): You are not connected to a company at SAPbobsCOM.ICompany.GetBusinessObject(BoObjectTypes Object) at InformaticaWorkflow.Service.Create() in E:\TIS_WebService\AsianPaints\Production\InformaticaWorkflow\InformaticaWorkflow\InformaticaWorkflow\Service.asmx.cs:line153 - Unable to access SBO-Common database
here,
1) -111 is integer returned by oComp.Connect();
2) Unable to access SBO-Common database , is returned byoComp.GetLastErrorDescription();
Here, if i comment the code for adding BP in B1 and keep just connection code to connect to B1 , then i am able to connect successfully.