I managed to connect to SAP B1 database using C# and SAP DI API version 9.00 and display ONE BP info.
What I want to do is display all BPs or one BP info in a GridView.
What I couldn't figure out is displaying all BPs/one BP info in a Gridview. In other words how to bind to a Gridview?
Thank you!
This is my code to connect which works perfect:
SAPbobsCOM.Company vCmp = new SAPbobsCOM.Company();
int lRetCode, lErrCode;
string sErrMsg;
vCmp.Server = "SAPR01";
vCmp.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2008;
vCmp.CompanyDB = "company";
vCmp.UserName = "user";
vCmp.Password = "*****";
vCmp.language = SAPbobsCOM.BoSuppLangs.ln_English;
lRetCode = vCmp.Connect();
if (lRetCode == 0)
{
label1.Text = "Hello World!";
}
else
{
label1.Text = "Connection Failed!";
}
lErrCode = vCmp.GetLastErrorCode(); sErrMsg = vCmp.GetLastErrorDescription();
vCmp.GetLastError(out lErrCode, out sErrMsg);
and this is my code to display BP's Name using a label:
SAPbobsCOM.BusinessPartners BP;
BP = vCmp.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oBusinessPartners);
string cardName;
if (BP.GetByKey("C70000"))
{
cardName = BP.CardName;
label1.Text = cardName;
}