Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15072

VS 2019 DataTable Adding Pirmary Key Values when adding a new row

$
0
0
I have a Primary Key that is an integer

I have a DataTable that has many rows from which I have deleted some.

When adding a new row I query the DataTable for the Highest Number and Assign that Number + 1 to the primary key column of the new row.

When execute the Update command to the Data Adapter I get an error indicating possible Duplicate values in my Primary Column

I suspect that the primary key value that I am adding also belongs to one of my deleted rows.

How can I add a unique primary key value

Thanks

Viewing all articles
Browse latest Browse all 15072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>