Javatpoint Logo
Javatpoint Logo


LINQ to DATASET means, performing a LINQ Query operation on the dataset. Generally, the dataset is the most widely used component in ADO.NET because it is built with disconnected architecture, but it has limited querying capabilities. The LINQ to Dataset provides the facility to write richer queries on a dataset based on our requirement.

Syntax of LINQ to DATASET

Here is the syntax of writing the LINQ queries on ADO.NET dataset object.

From the above syntax, we have written the LINQ Queries on ADO.NET Dataset "ds" object to get the data.

LINQ to Dataset Example

How to use LINQ to Dataset, we will see with the example. For that, we will create a new web application and make the connection with SQL Server and write the queries on Dataset object using LINQ, to display the data in gridview.

Firstly, we will create one new table "EmployeeDetails" in the database, for that we will execute the following query in our database and insert some dummy data to show it in the application.

Now we will create a new web application for that we have to click on Go to file->Select New->Select Project like as shown below.

LINQ To Dataset

When we select the new project, a new popup will open in that we have to choose an empty web application and give name as "LINQ to DataSet" and click "OK" to create a new web application.

Now we will add the new web page to the application for that we have to Right-click on the application --> Select Add-> New Item->Select Web Form->give name "Default.aspx" and click "OK" button, it will create a new page in the application.

Now open Default.aspx page and write the code:

In the above example, we used Dataset object and write the LINQ Query on the dataset object to get the detail from the dataset where EmpName ends with "a". Now we will run the application.


LINQ To Dataset
Next TopicLINQ to Entities

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA