Different ways to generate the latest int type primary foreign key in code
问题 I am new to sql. I have added 2 new tables in database. The primary key of first is a foreign key in the other. The type of the keys is integer. Now I want to generate the keys in the code and assign it to new data so that the association between different rows of the tables is right. How do I ensure uniqueness of keys and also get the latest key from the db so that there are no errors while saving. If I had used guids then I would have assigned a new guid to the primary key and then assigned