0

how do i write the following sql query in Lambda expression.

select rating from ratingtable where movieId=@movieid and userid=@userid 

2 Answers 2

1

You mean in LINQ? Like this:

var movieId = 3902;  // use valid movie ID
var userId = 5802;   // use valid user ID
ratingtable.Where( x => x.movieId==movieId && x.userid==userId )
Sign up to request clarification or add additional context in comments.

Comments

0
var results = from rt in ratingtable.Where(rt => rt.movieId == movie && rt.userid == user)
select rt

This is a great place to start as well for simple queries: http://code.msdn.microsoft.com/101-LINQ-Samples-3fb9811b

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.