添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

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:line 153 - Unable to access SBO-Common database


here,

1) -111 is integer returned by oComp.Connect();

2) Unable to access SBO-Common database , is returned by oComp.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.

Hi Chaitanya,

a few fix in your codes :

oComp = new SAPbobsCOM.Company();

oComp.Server = DbServer;

oComp.CompanyDB = "APHS_CONSOLE_LIVE";

oComp.UserName = "*****";

oComp.Password = "******";

oComp.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2012;

oComp.LicenseServer = "localhost:30000";

oComp.Connect();

if(oCom.Connected)

{

SAPbobsCOM.BusinessPartners oCustomer = oComp.GetBusinessObject(SAPbobsCOM.boObjectTypes.oBusinessPartners) as SAPbobsCOM.BusinessPartners;

oCustomer.CardCode="8881212";

oCustomer.CardName = "Chaitanya";

int iErr = oCustomer.Add();

if(iErr!=0)

return oCom.GetLastErrorDescription();

else

return "Success";

}

else

{

string error = oComp.GetLastErrorDescription();

xml = finalOutput(temp + " - " + e.ToString() + " - " + error);

return xml;

}

Regards

Edy

If i only try to connect , then i get successful connection.

Code:-

oComp = new SAPbobsCOM.Company();

oComp.Server = DbServer;

oComp.CompanyDB = "APHS_CONSOLE_LIVE";

oComp.DbUserName = "****";

oComp.DbPassword = "****";

oComp.UserName = "manager";

oComp.Password = "*****";

oComp.language = SAPbobsCOM.BoSuppLangs.ln_English;

oComp.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2012;

oComp.LicenseServer = "localhost:30000";

oComp.UseTrusted = false;

string error1 = "";

int temp=-1;

try{

temp= oComp.Connect();

if (oComp.Connect() != 0)

{

error1 = oComp.GetLastErrorCode() + "\n" +

oComp.GetLastErrorDescription();

}

c = "Connected successfully- " + temp+" - "+error1;

}

catch(Exception e)

{

string error = oComp.GetLastErrorDescription();

xml = finalOutput(temp + " - " + e.ToString() + " - " + error);

return xml;

}

//test part

xml = finalOutput(c);

return xml;


Output:- here -111 is the error code and  Unable to access SBO Common database is error description returned by , oComp.Connect();.


Missing connection of material XX in plant YY to the material ledger in Enterprise Resource Planning Q&A Connecting SAP BTP and On-Premise SAP Business One using the SAP Cloud Connector in Enterprise Resource Planning Blogs by SAP ODBC Connection Between SAP ECC and Excel in Enterprise Resource Planning Q&A Deciphering Seamless SAML Single Sign-On: SAP IAS Questions and Answers (part 2) in Enterprise Resource Planning Blogs by Members