Javatpoint Logo
Javatpoint Logo

LINQ to SQL Select Query

The select query in LINQ to SQL is used to get all the records or rows from the table. LINQ to SQL select query can be used to filter the records of the table with the where clause.

Here, we can also perform multiple operations like grouping, joining, etc. using LINQ to SQL select query based on our requirement.

Syntax of LINQ to SQL Select Query

Here is the syntax of LINQ to SQL Select Query.

With the above syntax, we are getting the records from the "EmployeeDetails" table using LINQ to SQL Select Query.

Example of LINQ to SQL Select Join

Before we start the implementation of the LINQ to SQL Inner Join first, here is a need to create a database with required tables. Map those tables LINQ to SQL file(.dbml). To know the process of the mapping, click on the link LINQ to SQL.

Once we create and map the required tables to .dbml file, now we want to show the data in our application. For that we have to Right-click on application->select add->new item->Select Web Form-> Give name as Default.aspx and click on the OK button.

Now open the page Default.aspx and write the code like as shown below.

Now open the code behind the file and write the code, as shown below:

From the above example, we are getting the details from the "EmployeeDetails" table using the LINQ to SQL Select Query.

OUTPUT

LINQ To SQL Select Query




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA