I am trying to add a data to a table . The row is created and the primary key is assigned initially. but when i enter the data in the form and hit commit the error says its already been created.
// Button Add
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Try
dsNewRow = DsSwLib.Tables("SoftwareLi
brary").Ne
wRow()
// primary key assigned during creation of row in the table
dsNewRow.Item("CEAT ID Number") = CeatID.Text
'dsNewRow.Item("Manufactur
er") = TextBox10.Text
Me.OleDbDataAdapter1.Updat
e(DsSwLib,
"SoftwareLibrary")
Catch ex As Exception
MessageBox.Show(ex.Message
, "Error")
End Try
End Sub
// Button Click
Private Sub btnCommit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCommit.Click
Try
DsSwLib.Tables("SoftwareLi
brary").Ro
ws.Add(dsN
ewRow)
Me.OleDbDataAdapter1.Updat
e(DsSwLib,
"SoftwareLibrary")
Me.DsSwLib.AcceptChanges()
Catch ex As Exception
MessageBox.Show(ex.Message
, "Error")
End Try
End Sub
Start Free Trial