Javatpoint Logo
Javatpoint Logo

LINQ to SQL Inner Join

In LINQ to SQL, Inner Join will return only the records or rows, which maps both the tables based on the defined conditions.

Syntax of LINQ to SQL Inner Join

Here is the syntax of using the LINQ to SQL Inner Join to get the data from the multiple tables.

C# Code

From the above syntax, we joined the "EmployeeDetails", "Departments" tables to get the required data by using the inner joins.

Example of LINQ to SQL Inner Join

Before the implementation of LINQ to SQL inner join, we need to create a database with required tables and map those tables to 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 the application->Select Add->New Item-> Select web Form-> Give name as Default.aspx and click OK button.

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

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

From the above example, we are trying to get the data from "EmployeeDetails" and "Departments" table using the inner join.


LINQ To SQL Inner Join

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA