在linq中获取基于客户端的用户登录名?

时间:2013-04-11 15:22:40

标签: vb.net linq linq-to-sql

如何使用LINQ查询基于用户名表检索客户端? enter image description here

2 个答案:

答案 0 :(得分:1)

搜索具有所需用户名的用户并获取相关客户端。

Dim username = "Bob"
Dim clients =
    From user In db.App_Users
    Where user.Username = username
    Select user.Dim_Client

答案 1 :(得分:0)

要根据用户名获取客户端,此类内容应该有效。

dim client = ( _
    From client In Dim_Client
    Where client.App_Users.Any(Function(user) user.Username = "foo")
    Select client).Single