private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { try { //DataTable dt = new DataTable(); db.Adapter("select distinct StudentName, Roll from StudentAttendance where Class = '" + comClass.Text.ToString() + "' and Shift ='" + cmShift.Text.ToString() + "' and Section = '" +cmSection.Text.ToString()+ "' and YearAt = '" + dateTimeYear.Text.ToString() + "'","student"); //MessageBox.Show(db.dataSet.Tables["student"].Rows.Count.ToString()); for (int i = 0; i < db.dataSet.Tables["student"].Rows.Count; i++) { grStudentAttend.Rows[i].Cells[0].Value = db.dataSet.Tables["student"].Rows[i][0].ToString(); grStudentAttend.Rows[i].Cells[1].Value = db.dataSet.Tables["student"].Rows[i][1].ToString(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
grStudentAttend.DataSource = db.dataSet.Tables["student"]; grStudentAttend.DataBind();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)