So I want to put a product in an order from an user in the database and the query goes as follows:
INSERT INTO [dbo].[Order](UserID, To_Adress, OrderDate, TravelTi
Try using the SQL OUTPUT clause:
INSERT INTO [dbo].[Order](UserID, To_Adress, OrderDate, TravelTime, ItemCount, Status, TotalPrice) OUTPUT inserted.ID VALUES (1, 'BIKINI BOTTOM', '20191030 15:00:00', '20191030 15:35:00', 1, 'InTheMaking', 7.50
In combination with SqlCommand.ExecuteScalar()