How to Convert ADO.NET to LINQ?

"SELECT TOP " + this.mintPageSize + " * FROM tblGroupDetail WHERE GroupDetailId NOT IN " + "(SELECT TOP " + intSkip + " GroupDetailId FROM tblGroupDetail)")

How Convert this Query to Linq.SomeOne tell me with Code?i have tried

var innerQuery = (from fb in db.tblGroupDetails where fb.GroupDetailID select fb).Take(this.mintPageSize); var result = from f in db.tblGroupDetails where innerQuery.Contains(f.GroupDetailID) select f;

Jon Skeet
people
quotationmark

I suspect you just need:

var query = db.GroupDetail
              .OrderBy(...) // You really need an ordering
              .Skip(intSkip)
              .Take(mintPageSize);

You should work out what ordering you want, otherwise "the first N" doesn't have any meaning.

That's not a translation of your query so much as your intent - you should check what SQL it generates.

people

See more on this question at Stackoverflow