0

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.

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by zmeditation1
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.