SELECT* FROM Event FULL OUTER JOIN Booking ON Event.eventId = Booking.eventId
WHERE(Booking.userId = 3) AND (Booking.bookingId IS NULL)
OR (Event.eventId IS NULL)
OR (Booking.eventId IS NULL)
这是我到目前为止所转换的,但我在 "&& bookings.bookingId == null"
错误消息为 "运营商&&'不能应用于' int'类型的操作数和' bool"
你是如何解决的?
User student = (User)Session["user"];
var db = new EMS.Models.dbEMSEntities();
IQueryable<Event> query = from events in db.Events
join bookings in db.Bookings
on events.eventId equals bookings.eventId
where bookings.userId = student.userId
&& bookings.bookingId == null || events.eventId == null || bookings.eventId == null
答案 0 :(得分:1)
where bookings.userId = student.userId && bookings.bookingId == null || events.eventId == null || bookings.eventId == null
正在评估为
where bookings.userId = (student.userId && bookings.bookingId == null) || events.eventId == null || bookings.eventId == null
因此,(int)userId&amp;&amp; (bool)(bookingId == null)将int
与违反该语言的bool
进行比较
确保使用“==”作为评估而不是作业“=”。
答案 1 :(得分:0)
User student = (User)Session["user"];
var db = new EMS.Models.dbEMSEntities();
IQueryable<Event> query = from events in db.Events
join bookings in db.Bookings
on events.eventId equals bookings.eventId
where (bookings.userId == student.userId)
&& (bookings.bookingId == null) || (events.eventId == null) || (bookings.eventId == null)