A
aliferunzi
Guest
I have a datagridview where it has columns where the first columns is the subject column in readonly mode and fifth column is the total column in readonly mode.When i insert numbers in column 2,3,4 should give up the total the fifth column.My datgridview is doing that without any problem but the problem is that when when i key in numbers in column 2 and 3 no information inserted unless i key in column 2, 3 and 4 the information will inserted.What i want is to key in in column 2 and 3 and information is inserted.Please help me where possible.
For Each row As DataGridViewRow In DataGridView1.Rows
If cmbexam.Text = "CAT 1" Then
sqlSTR = "SELECT ID, Subject, SubjNo, Class, Exam, OtherExam, Term, CAT1, CAT2, CAT3, ENDTERM, TOTAL, PAPER1, PAPER2, PAPER3, TOTAL2 FROM TBL_ResultsProcessing WHERE (Subject ='" & row.Cells(0).Value & "') AND (Class = '" & cmbform.Text & "') AND (Exam = '" & cmbexam.Text & "') AND (Term ='" & cmbterm.Text & "')"
ExecuteSQLQuery(sqlSTR)
If sqlDT.Rows.Count > 0 Then
sqlSTR = "UPDATE TBL_ResultsProcessing SET Subject ='" & row.Cells(0).Value & "', SubjNo ='" & txtsubjno.Text & "', Class ='" & cmbform.Text & "', Exam ='" & cmbexam.Text & "', Term ='" & cmbterm.Text & "', PAPER1 ='" & row.Cells(6).Value & "', PAPER2 ='" & row.Cells(7).Value & "', PAPER3 ='" & row.Cells(8).Value & "', TOTAL2 ='" & row.Cells(9).Value & "' WHERE (Subject ='" & row.Cells(0).Value & "') AND (Class = '" & cmbform.Text & "') AND (Exam = '" & cmbexam.Text & "') AND (Term ='" & cmbterm.Text & "')"
ExecuteSQLQuery(sqlSTR)
Else
sqlSTR = "INSERT INTO TBL_ResultsProcessing (Subject, SubjNo, Class, Exam, Term, PAPER1, PAPER2, PAPER3, TOTAL2) VALUES ('" & row.Cells(0).Value & "','" & txtsubjno.Text & "','" & cmbform.Text & "','" & cmbexam.Text & "','" & cmbterm.Text & "','" & row.Cells(6).Value & "','" & row.Cells(7).Value & "','" & row.Cells(8).Value & "','" & row.Cells(9).Value & "')"
ExecuteSQLQuery(sqlSTR)
End If
End If
Next
Continue reading...
For Each row As DataGridViewRow In DataGridView1.Rows
If cmbexam.Text = "CAT 1" Then
sqlSTR = "SELECT ID, Subject, SubjNo, Class, Exam, OtherExam, Term, CAT1, CAT2, CAT3, ENDTERM, TOTAL, PAPER1, PAPER2, PAPER3, TOTAL2 FROM TBL_ResultsProcessing WHERE (Subject ='" & row.Cells(0).Value & "') AND (Class = '" & cmbform.Text & "') AND (Exam = '" & cmbexam.Text & "') AND (Term ='" & cmbterm.Text & "')"
ExecuteSQLQuery(sqlSTR)
If sqlDT.Rows.Count > 0 Then
sqlSTR = "UPDATE TBL_ResultsProcessing SET Subject ='" & row.Cells(0).Value & "', SubjNo ='" & txtsubjno.Text & "', Class ='" & cmbform.Text & "', Exam ='" & cmbexam.Text & "', Term ='" & cmbterm.Text & "', PAPER1 ='" & row.Cells(6).Value & "', PAPER2 ='" & row.Cells(7).Value & "', PAPER3 ='" & row.Cells(8).Value & "', TOTAL2 ='" & row.Cells(9).Value & "' WHERE (Subject ='" & row.Cells(0).Value & "') AND (Class = '" & cmbform.Text & "') AND (Exam = '" & cmbexam.Text & "') AND (Term ='" & cmbterm.Text & "')"
ExecuteSQLQuery(sqlSTR)
Else
sqlSTR = "INSERT INTO TBL_ResultsProcessing (Subject, SubjNo, Class, Exam, Term, PAPER1, PAPER2, PAPER3, TOTAL2) VALUES ('" & row.Cells(0).Value & "','" & txtsubjno.Text & "','" & cmbform.Text & "','" & cmbexam.Text & "','" & cmbterm.Text & "','" & row.Cells(6).Value & "','" & row.Cells(7).Value & "','" & row.Cells(8).Value & "','" & row.Cells(9).Value & "')"
ExecuteSQLQuery(sqlSTR)
End If
End If
Next
Continue reading...