from and select in c# .net?

前端 未结 5 1002
后悔当初
后悔当初 2021-01-29 10:02

Can anyone Please tell me how to specify the particular column in the select statement given below:

var combinedrows = from dt1 in DsResults.Tables[0].AsEnumerab         


        
5条回答
  •  生来不讨喜
    2021-01-29 10:51

    Just read your comment. I think what you want is not a join but the following:

    var combinedrows = 
        from dt1 in DsResults.Tables[0].AsEnumerable()
        from dt2 in DsResults.Tables[1].AsEnumerable()
        where dt1.Field("MethodName") equals dt2.Field("MethodName")
        select new { dt1, dt2 };
    

    It returns ony rows from both tables that have the same "MethodName".

提交回复
热议问题