I have a server and many clients, my application is on clients and database on server, i have one table
Table --> Id --> int Auto-increment,
Name --> nvarchar(50),
So, whenever i insert a new row from client with query
Insert into Table Name Values('NameValue')
It inserts the row and sql auto generates the Id field. So, to fetch its Id, I use the following query
Select max(Id) as maxId from Table
but both queries are on different connections
It works well when only one client is operating at a time, but when multiple clients are working, Many insert queries are requested by clients before i could request the 'getMaxId' query.