I have a table which I am updating a single record using LINQ, but my condition to fetch that record is 2. My condition is this:
Test p = dt.Tests.Single(c => c.ID == getID);
But I want to add another condition:
Where Cust_ID == 1. Something like this:
Test p = dt.Tests.Single(c => c.ID == getID && t=> t.Cust_ID == 1);
But I cannot get hold of this situation using LINQ. Any help pls?
You need to put the logical operator inside the lambda:
dt.Tests.Single(c => (c.ID == getID && c.Cust_ID == 1) )
The inner parentheses are not needed; I added them to clarify that it's all one lambda.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With