1
Reply

Is it Same or Using Datarelations will save time?

narasimman g

narasimman g

Aug 30 2011 1:47 AM
1.3k
Hi Everyone,

Hope you ppl are doing good, I need a suggestion.I have been working on Performance tuning.Consider the below Scenario

Three tables from Database A,B,C
Primary key in A and same Foreign keys in B and C

We retrieved three tables and performing a looping based on the Primary Key ID.in the following manner

Scenario 1
for
{
for
{
if A Primary is Equal to B  Foreign{}
}
for
{
if A Primary is Equal to C Foreign{}
}
}
We all knew It loops more times ..I have more than 100 records in each table..
Now i cosidered to add Datarelation in dataset between three tables.
and use the below coding

Scenario 2
foreach(datarow dr in A.rows)
{
foreach(Datarow dr1 in dr.GetChildRows("RelationName"))
{


}
}
}


Please suggest me guys.

Answers (1)