UPDATE Consider 2 Tables.
Events Table. eventID int pk status1 int status2 int
Status Table ID int pk statusName varchar
now each events has 2 statuses written in int. And I want to show event rows on the screen but to get corresponding status name from Status table. Thus I have to join events table 2 times to status table. using status1,status2 ints to ID of status table.
While using entity framework I was writing such code
join ds1 in db.Status on te.aStatus equals ds1.ID
join ds2 in db.Status on te.bStatus equals ds2.ID
select new {
Status1 = ds1.statusName,
Status2 = ds2.statusName,
}
But now for some reasons I don't want to use Entity Framework , instead of that I want to write this directly in SQL I can join 2 dbs easely by
SELECT db.Status.statusName FROM db.Main INNER JOIN
Status ON dbo.Main.aStatus = dbo.Status.ID"
and this will work. but how can I make second join ?
After SELECT I take this DataTable Object and get rows in loop. And in that loop I create from that rows List. And there I must get 2 statuses
foreach (DataRow item in dtbProduct.Rows)
{
StatusList.Add(new JStatus()
{
Status1= item["statusName"] ???
Status2=item["statusName"] ???
How can I get here 2 variables for each status ?