In LINQ to SQL, the select query is useful to get all the records or rows from the table, and we can use LINQ to SQL select query to filter table records with where clause.
We can perform multiple operations like grouping, joining, etc., using LINQ to SQL select queries based on our requirements.
Following is the syntax of using LINQ to SQL Select query to get required records or rows from the table.
If you observe the above syntax, we are getting records from the “EmployeeDetails” table using LINQ to SQL Select query.
Before we start implementing LINQ to SQL inner join example, we need to create a database with required tables and map those tables to LINQ to SQL file (.dbml). If you don't know the process, don't worry check this link create and map database tables to LINQ to SQL file (.dbml).
Once we create and map required tables to the .dbml file, we will show data in our application for that; Right-click on the application à select Add à New Item à Select Web Form à Give name as Default.aspx, and click OK button.
Now open the Default.aspx page and write the code as shown below.
Now open the code behind file and write the code as shown below.
If you observe the above example, we are getting details from the “EmployeeDetails” table using LINQ to SQL Select query.
Following is the result of the LINQ to SQL stored procedure example.
This is how we can use LINQ to SQL Select query in c#, vb.net to get multiple records or filter table data based on our requirements.