Home
Lessons
Tutorials
sharepoint 2013
sharepoint 2010
C# & .Net
HTML
PHP
jQuery
AngularJS
CSS
General
Facebook Tricks and Tips
About Us
Contact Us
LINQ SQL
Home >
Lesson >
Chapter 7
5
Steps -
3
Clicks
Basic Info/Lessons
LINQ - Tutorial
LINQ - Overview
LINQ - Environment Setup
LINQ - Operators
LINQ - Queries
LINQ - Syntax
LINQ - SQL
LINQ - Objects
LINQ - Dataset
LINQ - XML
LINQ - Lambda Expressions
LINQ - ASP.NET
LINQ SQL
LINQ to SQL
Introduction
In this article, I am going to explain "How to connect LINQ to SQL". Please follow the below steps to work with the LINQ to SQL.
Open the
SQL server
and create tables as shown in the below figure.
Description
Create a new windows forms application in
Visual Studio.
Add the connection using
Server Explorer.
Now, Go to
Solution Explorer
and then right click on the Application.
Click on the
Add->New Item
. Then the following window will appear.
Select the
Data
and then
LINQ to SQL.
Give the
Name
as you want like
Employee.dbml
Go to
Server Explorer
and then expand the tables.
Select the tables and drag the tables on to the empty screen.
Interanally it will generate two classes.
Employee
DataContext
Class
EMP Details Class with the TableName
Go to code window and then write the code for the following design.
Write the following code in the
Employee.aspx.cs
[csharp] [/csharp]
Now, Run the Application. Then you will get all the employees who are males in a gridview.
This is the process to work with LINQ to SQL.
Hide Index
Show Index
Chapter 7
Previous
Next