class Program
{
// String oBP;
static void Main(string[] args)
{
string sError;
int errcode, retcode;
SAPbobsCOM.Company oCompany;
oCompany = (new SAPbobsCOM.Company());
// SAPbobsCOM.Company oCompany = default(SAPbobsCOM.Company);
oCompany.Server = "Srinivasan-PC"; /* Server Id */
oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2008; /* Type of Server to connect */
oCompany.UserName = "manager"; /*SAP Logon User ID */
oCompany.Password = "manager"; /* SAP Logon Password */
oCompany.LicenseServer = "Srinivasan-PC"; /*SAP License Server in Administration */
oCompany.DbUserName = "sa"; /* Database User Id */
oCompany.DbPassword = "Srinivasan@123"; /* Database Password */
oCompany.CompanyDB = "SBODemoIN";
oCompany.UseTrusted = true;
oCompany.language = SAPbobsCOM.BoSuppLangs.ln_English;
retcode=oCompany.Connect();
if (retcode != 0)
{
oCompany.GetLastError(out errcode,out sError);
MessageBox.Show(" Error "+ sError + "; Code" + errcode );
}
Console.WriteLine("Conected to " + oCompany.CompanyDB);
SAPbobsCOM.BusinessPartners oBp = (SAPbobsCOM.BusinessPartners)oCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners);
oBp.CardCode = "C10098";
oBp.CardName = "Srini";
oBp.CardType = SAPbobsCOM.BoCardTypes.cCustomer;
int rcd = oBp.Add();
if (rcd != 0)
{
oCompany.GetLastError(out errcode, out sError);
}
else {
Console.WriteLine("Successfully added");
}
Console.Read();
In my output i can get Connected to SBODemo.In Only. Last time i run this program it shows exception handling on creating business partner instance.