本文介绍了LINQ结果到数据表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 您好我已经编写了以下LINQ查询...我想将此结果添加到DataTable var select =( from objmemberinfo in db.tbl_MemberTransactions 其中​​ objmemberinfo.MemberId == dic.Key 选择 new {objmemberinfo.MemberId,MemberName = objmemberinfo.tbl_MemberMaster.MemberFirstName + + objmemberinfo.tbl_MemberMaster.MemberLastName,objmemberinfo.SponceID,objmemberinfo.PlacemMentID,objmemberinfo.tbl_MemberMaster.tbl_ProductTbl.productName,ActivationDate =(objmemberinfo.tbl_MemberMaster.Status == true ? string .Format( {0:dd / MM / yyyy},objmemberinfo。 tbl_MemberMaster.JoiningDate): NOT ACTIVE),Position =(objmemberinfo.Position == 0? 左: 右),状态=(objmemberinfo.tbl_MemberMaster.Status == false ? 非活动: ACTIVE )})。 Single (); 请帮我解决这个问题.. 。 我的尝试: var select =(from db.tbl_MemberTransactions中的objmemberinfo 其中objmemberinfo.MemberId == dic.Key 选择新的{objmemberinfo.MemberId,MemberName = objmemberinfo.tbl_MemberMaster.MemberFirstName ++ objmemberinfo。 tbl_MemberMaster.MemberLastName,objmemberinfo.SponceID,objmemberinfo.PlacemMentID,objmemberinfo.tbl_MemberMaster.tbl_Pro ductTbl.productName,ActivationDate =(objmemberinfo.tbl_MemberMaster.Status == true? string.Format({0:dd / MM / yyyy},objmemberinfo.tbl_MemberMaster.JoiningDate):NOT ACTIVE),Position =(objmemberinfo.Position ==0?Left:Right), Status =(objmemberinfo.tbl_MemberMaster.Status == false?NOT ACTIVE:ACTIVE)})。Single(); 解决方案 Hello I have written following LINQ query... I want to add this result into DataTablevar select =(from objmemberinfo in db.tbl_MemberTransactions where objmemberinfo.MemberId == dic.Key select new { objmemberinfo.MemberId, MemberName = objmemberinfo.tbl_MemberMaster.MemberFirstName + " " + objmemberinfo.tbl_MemberMaster.MemberLastName, objmemberinfo.SponceID, objmemberinfo.PlacemMentID, objmemberinfo.tbl_MemberMaster.tbl_ProductTbl.productName, ActivationDate = (objmemberinfo.tbl_MemberMaster.Status == true ? string.Format("{0:dd/MM/yyyy}", objmemberinfo.tbl_MemberMaster.JoiningDate) : "NOT ACTIVE"), Position = (objmemberinfo.Position == "0" ? "Left" : "Right"), Status = (objmemberinfo.tbl_MemberMaster.Status == false ? "NOT ACTIVE" : "ACTIVE") }).Single();Please help me for this solution...What I have tried:var select =(from objmemberinfo in db.tbl_MemberTransactions where objmemberinfo.MemberId == dic.Key select new { objmemberinfo.MemberId, MemberName = objmemberinfo.tbl_MemberMaster.MemberFirstName + " " + objmemberinfo.tbl_MemberMaster.MemberLastName, objmemberinfo.SponceID, objmemberinfo.PlacemMentID, objmemberinfo.tbl_MemberMaster.tbl_ProductTbl.productName, ActivationDate = (objmemberinfo.tbl_MemberMaster.Status == true ? string.Format("{0:dd/MM/yyyy}", objmemberinfo.tbl_MemberMaster.JoiningDate) : "NOT ACTIVE"), Position = (objmemberinfo.Position == "0" ? "Left" : "Right"), Status = (objmemberinfo.tbl_MemberMaster.Status == false ? "NOT ACTIVE" : "ACTIVE") }).Single(); 解决方案 这篇关于LINQ结果到数据表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的..
09-07 19:37