Click here to Skip to main content
15,667,536 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All

How to convert the following sql server query in to linq and save it in to a variable

select Name
from tblStudent
where Stid=106
CHill60 25-Jun-15 19:08pm    
Have you tried anything?

1 solution

Something like following
var studName=
        from tbl in objDataContextClass.GetTable<tblstudent>()
        where tbl.Stid==106
        select tbl.Name;

You need to learn few things before you can actually implement this. Read this article
Simple LINQ to SQL in C#[^]

Hope, it helps :)
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900