I'm trying to add a new row to my database so that i can add a new record. But it always gives this error: "Object reference not set to an instance of an object." And i can't figure out. Can you guys help me? I ahve my codee.
Private Sub StudentInfo()
If inc <> -1 Then
Dim cb As New OleDb.OleDbCommandBuilder(da)
Dim dsNewRow As DataRow
dsNewRow = ds.Tables("StudentInfoDataSet").NewRow()
dsNewRow.Item(1) = txtFname.Text
dsNewRow.Item(2) = txtMname.Text
dsNewRow.Item(3) = txtSurname.Text
dsNewRow.Item(4) = txtAddress.Text
dsNewRow.Item(5) = cmbSex.Text
dsNewRow.Item(6) = dtpBirthdate.Text
dsNewRow.Item(7) = txtBirthplace.Text
dsNewRow.Item(8) = txtCitizenship.Text
dsNewRow.Item(9) = txtReligion.Text
dsNewRow.Item(10) = txtContactNo.Text
dsNewRow.Item(11) = txtStudentNo.Text
dsNewRow.Item(12) = txtSY.Text
dsNewRow.Item(13) = cmbYL.Text
dsNewRow.Item(14) = cmbStatus.Text
ds.Tables("StudentInfoDataSet").Rows.Add(dsNewRow)
da.Update(ds, "StudentInfoDataSet")
End If
End Sub