Iwrote a c# code and it seemed correct for me
public static BCSMappedTable GetMappedTable(string p_ListName)
{
List<BCSDataBase> ConnexionList = BCSManagement.GetAllDataBases();
bool found = false;
foreach (BCSDataBase connexion in ConnexionList)
{
foreach (BCSMappedTable tabList in connexion.GetMappedTables())
{
if (tabList.getListeName().Equals(p_ListName))
{
found = true;
return tabList;
}
}
}
if (found)
return new BCSMappedTable();
}
but this error keeps appearing
error : not all code paths return a value
and I don’t have a clue why ! I lean I always return the required value
At the end of the function, if
foundis false, you don’t have a return path…As you have a
returnstatement inside your loop, the function will exit as soon as the item is found, thus you don’t need thefoundvariable. You can go with something like: