您好我的代码如下:
List<COSIS_DAL.PaymentsHeader> pheadr = c.GetPaymentHeaderByPayDate(PayDate);
public List<PaymentsHeader> GetPaymentHeaderByPayDate(DateTime payDate)
{
CosisEntities db = new CosisEntities();
IQueryable<PaymentsHeader> query = (from p in db.PaymentsHeaders
where p.PaymentDate.Value.Day == payDate.Day
&& p.PaymentDate.Value.Month == payDate.Month
&& p.PaymentDate.Value.Year == payDate.Year
select p);
return query.ToList();
}
所以我想将数据从 pheadr 保存到这样的字符串:
string keyword = Convert.ToString(pheadr.Select(m => m.VoucherNumber));
但我没有得到列表中的值。而不是我得到的价值:
System.Linq.Enumerable+WhereSelectListIterator`2[COSIS_DAL.PaymentsHeader,System.String]
请帮助我。我真的很麻烦。提前致谢。