· First we have to create Data Context Class. Once
Data Context is created we can query object model using LINQ query.
·
First we have created Employee Table which has
following Structure and Data.
In practical situations we
will have to remove duplicate rows and get only unique rows for reporting.
Assume we have the following data in the Employee Table.
In SQL Query to can use the DISTINCT clause to filter out
duplicate rows as follows
SELECT DISTINCT First_Name, Last_Name, City FROM Employee
Now let us see how the
same can be achieved using a LINQ query and bind data source in grid view
control as following way.
HTML code in UI level
Output
No comments:
Post a Comment