LINQ to SQL


This is one of the most useful and the easiest method to do database operation with sqlserver
  • Its all features located in System.Data.Linq
  • It also include basic object relation (O/R) mapper directly in Visual studio.
  • The O/R mapper enables you to quickly map sql-based datasource to CLR object.

Just Follow these simple steps:

Step 1: Add a LINQ to SQL Class like this


LingtoSql1.gif

Step 2: Drag the Database table which one you are going to use.


LingtoSql2.gif

Step 3: Save the page(Ctrl + s) where serialization mode=”Unidirectional” like this image


LingtoSql3.gif

Step 4: Then In Design page, take one Gridview and Linqdatasource control and configure the Linqdatasource control like this


LingtoSql4.gif

LingtoSql5.gif

Step 5: You will get output like this

LingtoSql6.gif
 

Next Recommended Reading Group By In Linq To Sql