problem
How to allow concurrency when multi user work on same windows form ?
I work on visual studio 2015 windows form application csharp
I have table name Employee on sql server 2012 have three fields
Serial int pk(primarykey)
EmployeeName nvarchar(100)
Address nvarchar(100)
Tel nvarchar(100)
I have windows form FrmEmployee
This windows form may be access from multi users on same time may be 5 user
When these five users open windows form frmemployee on same time
If two users insert same record on same time it will make violation primary key so That how to prevent that
from happen
Example
IF I have 3 users A,B,C
Suppose in table Employee last serial or max serial is 5
FrmEmployee windows form have textbox Serial
WHEN user A open windows form FrmEmployee then serial will be get next as 6 this is no problem for one user
but if user A open windows form and serial be 6 then
on same time
User B open windows form FrmEmployee and serial will be 6
When add data user A will add record success
But B will give him violation primary key
SO that
How to solve this problem please ?
What I have tried:
if user A open windows form and serial be 6 then
on same time
User B open windows form FrmEmployee and serial will be 6
When add data user A will add record success
But B will give him violation primary key