Articles → .NET → Using LINQ To SQL For Single Table
Using LINQ To SQL For Single Table
- Create a web-based application.
- Right click on project
- Click "Add New Item".
- Select "LINQ to SQL classes" from "Add New Item Template" and name them say test.dbml.Click to Enlarge
- Using Server Explorer, connect to the database.
- After you connect to the database, drag a table into the test.dbml. fileClick to Enlarge
- When you drag the table, a class Person is added for the table. In this class property is defined for each column of the database table.
- Apart from that another class testDataContext is created inherits from System.Data.Linq.DataContext , we are using this class further while we manipulate data from the database.
Executing Stored Procedure