getting available venues for appointment RRS feed

  • Question


    I have 2 tables: 'Appointment' and 'Venue', Appointment has a VenueID references the VenueID in Venue table. On my appointment form i have a start datetime and end datetime a venue selector, and a link 'Show available venues'. The link "Shw Available Venues" finds out the avialble venues based on user entered start and end datetime values. My code below seems only half working. Could anyone please help pointing out what i am doing wrong?



    from v in db.Venueswhere 
    a=>(startDate >= a.StartDate && startDate <= a.DueDate) || (endDate >= a.StartDate && endDate <= a.DueDate) || (startDate < a.StartDate && endDate > a.DueDate)



    thanks in advance




    • Edited by ssfftt Wednesday, December 14, 2011 12:46 AM
    Tuesday, December 13, 2011 9:11 AM


  • Hi ssfftt,

    Welcome to MSDN Forum!

    Base on the issue, you can write the query statement like this:

    var query = from a in db.Appointments join v in db.Venus on a.VenusID equals v.ID where a.StartDate <= startDate && a.DueDate>= endDate select v.Name;

    Then after user appointing a date period, the query can return a collection of available venues' name.

    Best Regards

    Allen Li [MSFT]
    MSDN Community Support | Feedback to us
    • Marked as answer by Allen_MSDN Monday, December 19, 2011 2:05 AM
    Thursday, December 15, 2011 2:31 AM