C# LINQ join With Just One Row

Posted by Soo on Stack Overflow See other posts from Stack Overflow or by Soo
Published on 2010-05-21T15:40:38Z Indexed on 2010/05/21 16:10 UTC
Read the original article Hit count: 171

Filed under:
|
|

I'm trying to make a query that grabs a single row from an SQL database and updates it.

TableA
AId
AValue

TableB
BId
AId
BValue

Ok, so TableA and TableB are linked by AId. I want to select a row in TableB based on AValue using a join. The following query is what I have and only grabs a value from TableB based on AId, I just don't know how to grab a row from TableB using AValue. I know you would need to use a join, but I'm not sure how to accomplish that.

var row = DbObject.TableB.Single(x => x.AId == 1)
row.BValue = 1;
DbObject.SubmitChanges();

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ