I have two tables:
我有两张桌子:
Clients, and a join table that has user id, a foreign key to clients, and some other stuff.
客户端,以及具有用户标识,客户端外键和其他一些东西的连接表。
I want to do this SQL
我想做这个SQL
select TblClient.* from TblClient inner join tblUserClientProjJoin as b on TblClient.Client_ID = b.Client_FK where b.User_fk = 2
选择TblClient。*从TblClient内部联接tblUserClientProjJoin作为b在TblClient.Client_ID = b.Client_FK上,其中b.User_fk = 2
So getting a list of 'clients' that a specific user has access to.
因此,获取特定用户可以访问的“客户”列表。
I want to apply this result to collection I can bind to controls.
我想将此结果应用于我可以绑定到控件的集合。
Anyone?
1 个解决方案
#1
var q = From c in db.TblClient join
ucp in db.tblUserClientProjJoin on
c.Client_ID equals ucp.Client_FK
select c;
I haven't tested this so you may need to modify it a little. Hope this helps!
我没有对此进行测试,因此您可能需要对其进行一些修改。希望这可以帮助!
#1
var q = From c in db.TblClient join
ucp in db.tblUserClientProjJoin on
c.Client_ID equals ucp.Client_FK
select c;
I haven't tested this so you may need to modify it a little. Hope this helps!
我没有对此进行测试,因此您可能需要对其进行一些修改。希望这可以帮助!