I am trying to add a new record into a access database, which I have succeeded in doing, but now I would like to be able to add a record to a table that a primary key. So I am trying increment my primary key by one and then add the rest of the records details but I am coming up with that error message. The primary key is an integer.
IntMax = DataMax.Tables(0).Rows(0).Item(0) + 1
ItemRow("ItemId") = IntMax
ItemRow("Type") = ComboType.Text
TblItems.Rows.Add(ItemRow)
Dim objcommandbuilder As New OleDb.OleDbCommandBuilder(Itemsadapter)
Itemsadapter.Update(DataItemAll, "Items")
Thanks
Louisa
|