LINQ is about integrating query operations into the .NET platform in a comprehensive and open manner. It’s also about providing a unified way for you to query across any kind of data that you have in your program, whether it’s relational, objects or XML.
LINQ TO SQL
LINQ to SQL allows .NET developers to write “queries” in their .NET language of choice to retrieve and manipulate data from a SQL Server database.
Here I’m trying to explain LINQ TO SQL by a simple program.Create table as shown in screenshot.
Add some data to the table as follows.
Create a new windows application and add DataGridView to the Form.
Then add LINQ TO SQL Classes to the project.For this click Project menu and click Add New Item.Then select Data in Categories and LINQ TO SQL Classes in Templates and click Add button.
Then drag the tables from the Server Explorer to the DataClasses1.dbml.
Now we are moving to the code part. Go to the Form Load event of the Form by double clicking the Form. Then add following code.
Run the code.
No comments:
Post a Comment