0
    var Player = from PSI in regConfig.Player_SeasonalInfos
              from PPI in regConfig.Player_PermanentInfos
              where PSI.PaymentId == PlayerPayment.PaymentId
              && PPI.PlayerId == PSI.PlayerId
         select new { 
                        PlayerIds = string.Join(",", PSI.PlayerId), 
                        PlayerSeasonalId = PSI.PlayerSeasonalId,         
                        CityId = PPI.CityId 
                    };                                    

    foreach (var item in Player)
    {

     Player_SeasonalInfo PlayerSeasonalInfos = 
                              (from PSI in regConfig.Player_SeasonalInfos
                              where PSI.PlayerSeasonalId ==item.PlayerSeasonalId
                              select PSI).FirstOrDefault();
     PlayerSeasonalInfos.StatusId = item.CityId == 1 ? 1 : 2;
     regConfig.SubmitChanges();                                             
     }

我已经写了这段代码,但我得到了异常“invalidcastexception specified cast is not valid linq” on line”

from PSI in regConfig.Player_SeasonalInfos
where PSI.PlayerSeasonalId ==item.PlayerSeasonalId
select PSI" 

请建议。

4

0 回答 0