我想组合几个表字段以产生组合值。
这是我的代码:
from _showtime in db.tbl_Concert_Showtime join _concerthall in db.tbl_Concert_ConcertHall on _showtime.ConcertHallID equals _concerthall.ConcertHallID
join _hall in db.tbl_Concert_Hall on _concerthall.HallID equals _hall.HallID
join _hallfloor in db.tbl_Concert_Hall_Floor on _hall.HallID equals _hallfloor.HallID
join _place in db.tbl_Concert_Hall_Floor_Place on _hallfloor.FloorID equals _place.FloorID
where _place.PlaceID == id
select _showtime
showtime
表包含showID
,startdate
,starttime
和endtime
字段。
如何在字段中选择startdate
和starttime
?
这样的事情:2015/12/12 12:25 -> 12:58
答案 0 :(得分:3)
from _showtime in db.tbl_blablabla
select _showtime.startdate + " " + _showtime.starttime + " -> " + _showtime.enddate
如果您想保留原始Showtime对象但只是添加该组合值,请执行以下操作:
from _showtime in db.tbl_blablabla
select new
{
Showtime = _Showtime,
CombinedValue = _showtime.startdate + " " + _showtime.starttime + " -> " + _showtime.enddate
}