I have a datagridview which retrieve data from my ms access file

also I hid the primary key.

If I added another row and used da.Update(dt)
it gives an error because the primary key is empty.
now I have a separate textbox for that primary key how can I update the table and the primary key will get the value of textbox?

2 options:
a) do not hid the primary key, hid their visibility in the datagridview
b) use an OleDbCommand to upate the database, then refill the datatable and refresh the datagridview.

Hope this helps