private void btnSave_Click(object sender, EventArgs e) { //MessageBox.Show(grStudentAttend.Rows.Count.ToString()); //int count = grStudentAttend.Rows.Count; try { for (int i = 0; i < grStudentAttend.Rows.Count -1; i++) { db.command.Parameters.Add("@StudentName", SqlDbType.VarChar).Value =grStudentAttend.Rows[i].Cells[0].Value.ToString(); db.command.Parameters.Add("@Roll", SqlDbType.VarChar).Value = grStudentAttend.Rows[i].Cells[1].Value.ToString(); db.command.Parameters.Add("@Class", SqlDbType.VarChar).Value = comClass.Text.ToString(); db.command.Parameters.Add("@Shift", SqlDbType.VarChar).Value = cmShift.Text.ToString(); db.command.Parameters.Add("@Section", SqlDbType.VarChar).Value = cmSection.Text.ToString(); db.command.Parameters.Add("@Dated", SqlDbType.SmallDateTime).Value = Convert.ToDateTime(dateTimePicker1.Text.ToString()); db.command.Parameters.Add("@YearAt", SqlDbType.VarChar).Value = dateTimeYear.Text.ToString(); db.command.Parameters.Add("@MonthAt", SqlDbType.VarChar).Value = comMonth.Text.ToString(); if (DBNull.Value.Equals(grStudentAttend.Rows[i].Cells[2].Value) || grStudentAttend.Rows[i].Cells[2].Value.ToString() == "false") { db.command.Parameters.Add("@Attend", SqlDbType.Bit).Value = 0; //db.Adapter("sp_InsertStudentAttendance", true); //MessageBox.Show("Keep Attendance complete"); } else db.command.Parameters.Add("@Attend", SqlDbType.Bit).Value = 1; db.Adapter("sp_InsertStudentAttendance", true); MessageBox.Show("Keep Attendance complete"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
if (DBNull.Value.Equals(grStudentAttend.Rows[i].Cells[2].Value) || grStudentAttend.Rows[i].Cells[2].Value.ToString() == "false")
else
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)