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)
This is what i have converted so far however i have encounter an error at "&& bookings.bookingId == null"
The error message is " Operator '&&' cannot be applied to operands of type 'int' and 'bool"
How do you fix it?
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
where bookings.userId = student.userId && bookings.bookingId == null || events.eventId == null || bookings.eventId == null
is being evaluated as
where bookings.userId = (student.userId && bookings.bookingId == null) || events.eventId == null || bookings.eventId == null
Because of this, (int)userId && (bool)(bookingId == null) is comparing an int
against a bool
which violates the language Make sure you use "==" as an evaluation and not the assignment "=".
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.