0
Answer

check selected date in database from the calendar in C#

narasiman rao

narasiman rao

11y
2.1k
1

Validate Selected Date in date base from the calendar(month calendar control)

 Note it is windows application.
 
Database structure as follows in Ms Access;
 
Field Name Data Type
 
Holiday Date Text
Reason Text
 

In the Database records as follows in Ms Access;
 
Holidaydate Reason
 
14/11/2013 Children Day
15/08/2013 Indepence Day
2/2/213 Day
28/2/2013 Holiday
 
Design as follows;
 
I have one calendar as follows.
 
In that Calendar when user select the Sunday date, i validate sunday date is not allowed for that code as follows;
 
private void Facavailcal_DateChanged(object sender, DateRangeEventArgs e)
{
 
if (e.Start.DayOfWeek == DayOfWeek.Sunday) MessageBox.Show("Don't Select Sunday", "Not Allowed", MessageBoxButtons.OK, MessageBoxIcon.Information);
 
return;
 
}
 
The above code is working fine.
 

I have to check another, selected date in database from the calendar,  i want to show the pop message selected date is not allowed.
 
In the database records as follows;
 
14/11/2013  Children Day
15/08/2013  Indepence Day
2/2/213      Day
28/2/2013   Holiday
 

if the user select Database Date  from the calendar, i want to show the pop up message.
 
for that how can i do.
 
please help me.
Note it is windows application.
 
Regards,
Narasiman P