Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to prevent duplicate numbering when multiple people add records to the access (or mysql) database at the same time. The program is asp language.
How to prevent duplicate numbering when multiple people add records to the access (or mysql) database at the same time. The program is asp language.
In access, you can set the sid field to automatic numbering. You don't need to fill it out. Every time a new record is added, the sid will automatically become+1. Sqlserver has something similar, but it is more complicated. Mysql hasn't touched it. It should be about the same.

The statement "insert into s _ table (sid, sname, stype) values (s _ max+ 1,' Zhang San',' new user') does not need to add a sid field, but only needs to be written as insert into s _ table (sname, stype) values ('Zhang San',' new'). Sid will write it himself, automatically+1.