我有一个 Linq 语句,它必须检查哪个客户端连接到哪个用户
public List<Client_Dto> GetClientByBehandelaar(string loggedInUserId)
{
try
{
int userID = Convert.ToInt32(loggedInUserId);
nestorDBDataContext db = new nestorDBDataContext();
var result =
(from relaties in db.tbl_Relaties
where relaties.ID_Persoon == userID
select new Client_Dto()
{
ID = relaties.NestorNrCliënt
}).ToList();
List<Client_Dto> clienten = result;
return clienten;
}
catch (Exception e)
{
throw new ArgumentException("GetClientByBehandelaar Failed " + e);
}
}
但即使在数据库中有 87 个具有相同用户 ID 的情况下,它也只会选择一个。我一直盯着自己看这个..有人可以帮忙吗