When i add a new row to the database it updates both first row and last row. Therefore i need to stop the updating of first row. I coded as follows and I used MS Access as the database. Please help me to solve the error.
VB.NET:
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
Dim nrow As DataRow = StudentDataSet.Tables(0).NewRow
nrow(1) = StIDTextBox.Text
nrow(2) = NameTextBox.Text
nrow(3) = ClassTextBox.Text
nrow(4) = SchoolTextBox.Text
nrow(5) = GradeTextBox.Text
nrow(6) = Parent_NameTextBox.Text
nrow(7) = Contact_NoTextBox.Text
nrow(8) = AddressTextBox.Text
nrow(9) = InstituteTextBox.Text
StudentDataBindingSource.MoveLast()
StudentDataSet.Tables(0).Rows.Add(nrow)
Try
Me.Validate()
Me.StudentDataBindingSource.EndEdit()
Me.StudentDataTableAdapter.Update(Me.StudentDataSet.StudentData)
Catch ex As Exception
MsgBox("Database Update failed")
End Try
End Sub