note it is windows applciation.
I am suing msaccess database.
Database Design as follows;
table name Leave
Faculty Code text
Day text
Screen Name Common holidays.
Design as follows;
Faculty Code combobox
Day Combobox
In Combobbox all faculty code are retrieved from the another table)
in Days manually typed in the coding Monday to Satruday.
In run mode design screen as follows;
select the faculty code from combobox and select the day from the combobox and save it in the database for all faculty code.
Database Design as follows;
Faculty Code text
Available date text
Screen Name Faculty Availability
Design screen as follows;
faculty code Combobbox
Calendar(Month Calendar)
Datagridview.
In the combobox select the faculty code and select the month from the calendar selected month all dates will display in the datagridview.
in the datagridview, for that faculty code in selected month particular date is leave means that leave date is shown in different color in datagridview .
for that leave date storing in the leave table,checking whether for that faculty in the selected month any date is leave, when he leave that date is shown in different color in datagridiview.
that date is disable,cannot able to select that date.
in the run mode when i open, Faculty Availability screen
and select the faculty code from the combobox and select the month from the calendar,suppose for that month any date is leave from the faculty that date is shown in different color
simutaneously when i open Common holidays screen,
Show the error as follows;
unspecified error.
MY code Faculty Availability screen as follows in calerndar date changed event code as folows;
private void Faculty_Available_Calendar_DateChanged(object sender, DateRangeEventArgs e)
{
if (cb_Faculty_Code.Text.ToString().Trim() == "")
{
MessageBox.Show("Please Select the Faculty Code", "Not Select", MessageBoxButtons.OK, MessageBoxIcon.Information);
cb_Faculty_Code.Focus();
return;
}
DGVCalendar.Rows.Clear();
DateTime dt1 = Faculty_Available_Calendar.SelectionStart;
dt1 = new DateTime(dt1.Year, dt1.Month, 1);
DateTime dt2 = dt1.AddMonths(1);
int numDays = (dt2 - dt1).Days;
if (DGVCalendar.RowCount < numDays)
{
DGVCalendar.RowCount = numDays;
}
int row = 0;
while (dt1 < dt2)
{
DGVCalendar.Rows[row].Cells[1].Value = dt1.ToString("dd-MMM-yyyy");
DGVCalendar.Rows[row].Cells[0].Value = true;
DGVCalendar.Rows[row].Cells[0].Style.BackColor = Color.MistyRose;
DGVCalendar.Rows[row].Cells[1].Style.BackColor = Color.MistyRose;
DGVCalendar.Rows[row].Cells[2].Style.BackColor = Color.MistyRose;
DGVCalendar.Rows[row].Cells[2].Style.ForeColor = Color.Green;
if (dt1.DayOfWeek == DayOfWeek.Sunday)
{
DGVCalendar.Rows[row].ReadOnly = true;
DGVCalendar.Rows[row].Cells[0].Value = false;
DGVCalendar.Rows[row].Cells[0].Style.BackColor = Color.Orange;
DGVCalendar.Rows[row].Cells[1].Style.BackColor = Color.Orange;
DGVCalendar.Rows[row].Cells[2].Style.BackColor = Color.Yellow;
DGVCalendar.Rows[row].Cells[2].Style.ForeColor = Color.Red;
DGVCalendar.Rows[row].Cells[2].Value = "Sunday";
}
sql = "select Name from Tb_common_Holidays where Name = '" + cb_Faculty_Code.Text.ToString().Trim() + "' and Day = '" + dt1.DayOfWeek.ToString().Trim() + "' ";
dr = GFun.ReadAcessSql(sql);
dr.Read();
if (dr.HasRows == true)
{
DGVCalendar.Rows[row].Cells[1].Style.BackColor = Color.Pink;
DGVCalendar.Rows[row].Cells[2].Style.ForeColor = Color.Brown;
DGVCalendar.Rows[row].Cells[2].Value = dt1.DayOfWeek.ToString();
}
dt1 = dt1.AddDays(1);
row++;
}
}
what is the problem in my code?
Please help me,
when i run faculty availability screen and working, simutaneously when i open the common holidays screen that time error shows as follows;
unspecified error.
what is the problem?
[edit]Code block added - OriginalGriff[/edit]