TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mathi
NA
2
1.9k
Linq to SQL query to get all the descendats in c#
Sep 29 2014 1:30 AM
I need a
Linq to SQL
for which
I'll get Company name and Reporting Person's name as input.
From the below table I need to query and I need to get the values of the children and grand children and their descendants too.
Please find the sample data below:
For Ex:
if I get Company name =
'Intech'
and Reporting Person's name =
'Aashiq'
I need the below values
'Vignesh'
,
'Aashiq'
'KK'
,
'Aashiq'
'Dhanesh'
,
'Aashiq'
'Sanjeev'
,
'KK'
'Periyannan'
,
'Antony'
'Karthi'
,
'Antony'
'Prakash'
,
'Dhanesh'
'XXXX'
,
'Prakash'
'YYYY'
,
'Prakash'
Please help
CREATE
TABLE
Table1
(
CompanyName
VARCHAR
(
20
),
EmployeeName
VARCHAR
(
20
),
ReportingPersonName
VARCHAR
(
20
)
)
insert
into
Table1
Select
' Intech'
,
'Prem'
,
'Gandhi'
insert
into
Table1
Select
' Intech'
,
'JK'
,
'Gandhi'
insert
into
Table1
Select
' Intech'
,
'Gobind'
,
'Prem'
insert
into
Table1
Select
' Intech'
,
'KP'
,
'Prem'
insert
into
Table1
Select
' Intech'
,
'Venkat'
,
'Goind'
insert
into
Table1
Select
' Intech'
,
'Niyam'
,
'Goind'
insert
into
Table1
Select
' Intech'
,
'Aashiq'
,
'KP'
insert
into
Table1
Select
' Intech'
,
'James'
,
'KP'
insert
into
Table1
Select
' Intech'
,
'Linu'
,
'Venkat'
insert
into
Table1
Select
' Intech'
,
'Mathi'
,
'Niyam'
insert
into
Table1
Select
' Intech'
,
'Karthik'
,
'Niyam'
insert
into
Table1
Select
' Intech'
,
'Vignesh'
,
'Aashiq'
insert
into
Table1
Select
' Intech'
,
'KK'
,
'Aashiq'
insert
into
Table1
Select
' Intech'
,
'Antony'
,
'James'
insert
into
Table1
Select
' Intech'
,
'Dhanesh'
,
'Aashiq'
insert
into
Table1
Select
' Intech'
,
'Anitha'
,
'Linu'
insert
into
Table1
Select
' Intech'
,
'Manu'
,
'Mathi'
insert
into
Table1
Select
' Intech'
,
'Babu'
,
'Mathi'
insert
into
Table1
Select
' Intech'
,
'Kavya'
,
'Karthik'
insert
into
Table1
Select
' Intech'
,
'Subbu'
,
'Karthik'
insert
into
Table1
Select
' Intech'
,
'Sanjeev'
,
'KK'
insert
into
Table1
Select
' Intech'
,
'Periyannan'
,
'Antony'
insert
into
Table1
Select
' Intech'
,
'Karthi'
,
'Antony'
insert
into
Table1
Select
' Intech'
,
'Prakash'
,
'Dhanesh'
insert
into
Table1
Select
' Intech'
,
'XXXX'
,
'Prakash'
insert
into
Table1
Select
' Intech'
,
'YYYY'
,
'Prakash'
Reply
Answers (
2
)
How to perform (insert ,update,delete,cancel) in gridview
mapping relation in table[linq]