You need to insert a record and retrieve its unique ID number, which is generated by the database.
Use a database stored procedure that returns this information in an output parameter.
Many database tables use an ID or a GUID (globally unique identifier) field to uniquely identify records. This field is generated by the database when the record is created, not by the client. However, the client often needs to show this information to the user, and it might serve as a registration number or a confirmation number. To make it easy for the client to retrieve this information, it’s recommended that you use a stored procedure that explicitly returns this information.
For example, the Northwind ...