cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to use oCompany.GetCompanyList in DI API 9.2 in the login page?

former_member801815
Discoverer
0 Likes
679

I have a login page and I want to display the list of Company DB available in a certain DB server. I am aware of the oCompany.GetCompanyList but how do I use it when I was just about to login?

Accepted Solutions (0)

Answers (1)

Answers (1)

rasmuswulff_jensen
Active Contributor
0 Likes
Here is a code sample 
private List<Company> GetDatabasesForServer(string server, BoDataServerTypes serverType, BoSuppLangs language)
{
var result = new List<Company>();
SAPbobsCOM.Company c = new CompanyClass
{
Server = server,
DbServerType = serverType,
language = language
};
Recordset rs = c.GetCompanyList();
while (!rs.EoF)
{
string dbName = rs.Fields.Item(0).Value.ToString();
string name = rs.Fields.Item(1).Value.ToString();
result.Add(new Company(dbName, name));
rs.MoveNext();
}
return result;
}
wfletcher
Newcomer
0 Likes

Hi @rasmuswulff_jensen, is there a way to do this with B1UP? I am using SAP B1 10.0 HANA and I keep getting an error when running this line:

c.GetCompanyList();

The error that I'm seeing is: Exception from HRESULT: 0xFFFFFFFF