How about using SQL BETWEEN?
i.e.
WHERE (EventFrom BETWEEN @startDate and @endDate) OR (EventToBETWEEN @startDate and @endDate) )
What I'm not sure of, is how to update the Parameters of the ASP SQLdataSource I use to populate the DayPilotSchedule.
Any ideas?
SqlDataSourceEvents.SelectParameters["start"].DefaultValue = DateTime.Today.ToString("s");
<asp:ControlParameter Name="start" ControlID="DayPilotCalendar1" PropertyName="StartDate" />
Where would you put this?
Would it go everywhere you call DayPilotScheduler1.DataBind() ?
For example
Private Sub DayPilotScheduler1_Refresh(ByVal sender As Object, ByVal e As DayPilot.Web.Ui.Events.RefreshEventArgs) Handles DayPilotScheduler1.Refresh 'here? DayPilotScheduler1.DataBind() DayPilotScheduler1.Update() End Sub
> Would it go everywhere you call DayPilotScheduler1.DataBind() ?
Yes, exactly - before the DataBind() call.
See also this thread for an alternative SQL SELECT:
forums.daypilot.org/Topic.aspx/69/testing_for_overlapping_events_with_sql
It's called "testing for overlapping events" but it's the same logic.