How about the below technique of inserting records, removing the current table from dataset and then again populating dataset to navigate through records in text fields on form.
Routine to populate Dataset.
Routine to populate text fields on the form:
One of the navigation button (Next Record):
VB.NET:
Dim cmd As New SqlCommand("insert into tblEmp values(4,'Asad','Accountant','10/10/1988')", cn)
Dim dbread = cmd.ExecuteNonQuery()
MsgBox("Record Inserted")
ds.Tables.Remove("tblEmp")
populateDataset()
populateTextboxes(recordIndex)
Routine to populate Dataset.
VB.NET:
Private Sub populateDataset()
dap.SelectCommand = New SqlCommand("select * from tblEmp", cn)
dap.Fill(ds, "tblEmp")
End Sub
Routine to populate text fields on the form:
VB.NET:
Private Sub populateTextboxes(ByVal rowNo As Integer)
TextBox1.Text = ds.Tables(0).Rows(rowNo).Item(0)
TextBox2.Text = ds.Tables(0).Rows(rowNo).Item(1)
TextBox3.Text = ds.Tables(0).Rows(rowNo).Item(2)
TextBox4.Text = ds.Tables(0).Rows(rowNo).Item(3)
End Sub
One of the navigation button (Next Record):
VB.NET:
Private Sub btnN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnN.Click
If recordIndex < ds.Tables(0).Rows.Count - 1 Then
recordIndex = recordIndex + 1
populateTextboxes(recordIndex)
End If
End Sub
REM where recordIndex is an integer with a defaultvalue=0