开发者

subqueries linq

Hey all I am trying to do a subquery in linq but the subquery is a value and it seems to not be working, can anyone help out? I am using the entit frame work I keep getting and int to string error not sure why.

from lrp in remit.log_record_product
                                 join lr in remit.log_record on lrp.log_record_id equals lr.log_record_id
                                 where (lrp.que_submit_date >= RadDatePickerStartDate.SelectedDate) && (lrp.que_submit_date <= RadDatePickerEndDate.SelectedDate)
                                 select new { lrp.que_submit_date, 
                                     lr.officer_name, 
                                     lr.c_fname, 
                                     lr.c_lname, 
                                     lrp.price_sold, 
                                     lrp.product_cost,
                                     gap_account_number = (from gap in remit.gap_contracts where gap.log_record_product_id == lrp.log_record_product_id select gap.account_number),
                                     iui_account_number = (from iui in remit.iui_contracts where iui.log_record_product_id == lrp.log_record_product_id select iui.account_number),
                                     dp_account_number = (from dp in remit.dp_contracts where dp.log_record_product_id == lrp.log_record_product_id select dp.account_number),
                           开发者_JAVA百科          mpd_account_number = (from mpd in remit.mbp_contracts where mpd.log_record_product_id == lrp.log_record_product_id select mpd.product_account_number)
                                 }


Each sub-query is returning an Enumerable<Type>

Try to use (from c in collection).First() or use (from c in collection).FirstOrDefault()

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜