i tried but is not working not displaying in datagridview
In database records as follows;
Faculty Date Sess1 Sess2 Sess3 Sess4
RAM 1/1/2013 checkboxchecked checkboxchecked checkboxchecked checkboxchecked
RAM 2/1/2013 checkboxchecked checkboxchecked checkboxchecked checkboxchecked
Design as follows;
Faculty Code combo box
Datagridiview as follows;
Date Sess1 Sess2 Sess3 Sess4
1/1/2013 checkboxchecked checkboxchecked checkboxchecked checkboxchecked
2/1/2013 checkboxchecked checkboxchecked checkboxchecked checkboxchecked
in run mode when i click the Faculty Code, the particular faculty code record is to be retrieved from the database and display into the datagridview.
For that code as follows;
private void cb_Faculty_Code_SelectedIndexChanged(object sender, EventArgs e)
{
int irows = 0;
try
{
sql = "Select [Available_date],[Session1],[Session2],[Session3],[Session4] from Tb_Faculty_Availability where Faculty_code = '" + cb_Faculty_Code.Text.ToString() + "'";
dr = GFun.ReadAcessSql1(sql);
while (dr.Read())
{
for (irows = 0; irows < DGVCalendar.RowCount; irows++)
{
DGVCalendar.Rows[irows].Cells[2].Value = dr[0].ToString();
DGVCalendar.Rows[irows].Cells[4].Value = dr[1].ToString();
DGVCalendar.Rows[irows].Cells[5].Value = dr[2].ToString();
DGVCalendar.Rows[irows].Cells[6].Value = dr[3].ToString();
DGVCalendar.Rows[irows].Cells[7].Value = dr[4].ToString();
}
irows++;
}
dr.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error");
return;
}
In run mode when i click the combobox(Faculty code) in the datagridview the selected faculty code not displaying in the datagridview.
what is the problem in my above code?
Please help me.