What is Linq

In Generally we can say Linq is an one of the part of Microsoft .NET Framework 4.0 which provides native data querying capabilities  for .NET Lagrange.
Linq Has very similar syntax related to SQL.


The following example show the simple sysntax of Linq using C#


Sysntax:

var query = from records in employees where records.Gander = "Male"
            select records.Name;


This is the simple code of Linq Query. When we execute this snippet of code, it returns the all male employees name.

So now we have fetch the records now how to print this records ?

Displaying records is very simple. We can display the all records using loop whether it is for loop, while loop or foreach loop.

Lets check this example

foreach(var name in query)
{
     response.write(name);
}


Post a Comment Blogger

 
Top