Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Note it is windows application.
Database Design as follows (Table name Declaredholidays);
Holiday Reason

2/21/2013 Leave
2/25/2013 Holiday
5/3/2013 Not Available

I have month calendar in my project.

Design as follows;


calendar (Month calendar control)

when i select the month that month all date is display into the datagridview.

In the datagridview that month any date is match with Declaredholidays table that date should be shown in different color.


In datagridview as follows;

Select Month(selected month in month calendar)

Checkbox 2/1/2013
to
28/1/2013

In the declared holidays table 2/21/2013 and 2/25/2013 is there, the above two dates should be shown in different color in datagridview

for that code as follows;

C#
 private void Faculty_Available_Calendar_DateChanged(object sender, DateRangeEventArgs e)
        {

sql = "select Reason from Tb_Declared_Holidays where Holiday = '" + Faculty_Available_Calendar.selectionstart + "'";
            oledbdr = GFun.ReadAcessSql(sql);
            while (oledbdr.Read())
            {
               DGVCalendar.Rows[row].Cells[1].Style.BackColor = Color.Orange;
            }
       }


when i run in datagrdiview, for the 2/21/2013 and 2/25/2013 above two dates is not shown in differnt color.

what is the problem in my code.

please help me.



Regards,
Narasiman
Posted
Updated 26-Feb-13 17:17pm
v2
Comments
[no name] 26-Feb-13 23:32pm    
please replay for my above question.
Sergey Alexandrovich Kryukov 26-Feb-13 23:32pm    
Are you going to ask 12 questions all together? :-)
—SA
willington.d 26-Feb-13 23:36pm    
Hi.., I think you have selected Reason instead of Holiday from DeclaredHolidays.

"select Reason from Tb_Declared_Holidays where Holiday"

"select Holiday from Tb_Declared_Holidays where Holiday"
[no name] 27-Feb-13 0:06am    
"select Holiday from Tb_Declared_Holidays where Holiday"

u said the above query ok, but i have one doubt after where Holiday

then what i have to written in the above query.

"select Holiday from Tb_Declared_Holidays where Holiday = Faculty_Available_Calendar.SelectionStart.ToString()"

whether the above query is correct or not.
[no name] 27-Feb-13 0:06am    
please help me.

please help me.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900