hey,
i am developing a booking system and i want to check whether user check in dates are within booked dates.

for an example.

user wants to book 12/03 to 14/03,but some body has already booked 10/03 to 15/03.
For this scenario, we just cant check for 2 days,what i want to check is,the user asked dates are within another booked dates.
i want to do this in linq query.

hope you understand.

help needed asap,
thanks in advance.

Hi,

Check this..

StringBuilder strQ = new StringBuilder();
                strQ.Append("SELECT VALUE T FROM MyTable AS T WHERE T.ID > 0");
   if (FromDate != null)
                    strQ.Append(string.Format(" AND T.FromDate >= DATETIME'{0}'", FromDate.ToString("yyyy-MM-dd HH:mm:ss")));

                if (ToDate != null)
                    strQ.Append(string.Format(" AND T.ToDate <= DATETIME'{0}'", ToDate.ToString("yyyy-MM-dd HH:mm:ss")));
db.CreateQuery<MyTable>(strQ.ToString());

Hope this helps..

Please revert for any queries..

Regards,

Sravanthi Chepooru