Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Concurrency problem

Former Member
0 Kudos

I have a dialog program, which able to insert some record into database. In the table, the key field is number which increment 1 each time users create record + short description. When save, currenct machanism will get the last no from database and then insert into table. But if two or more users save at the sametime, the no will be same, but the short description is different, due to the key field is no + short desc, so it can insert successful, but now, user want to change the number must unique no. because the table currenly in use, so, i can't change the table of number field as unique key, how can i solve the problem. Thanks!

2 REPLIES 2

Former Member
0 Kudos

You can create a lock object for that table and lock the table before doing INSERT so that only one INSERT will take place at a time. In this way, your unique no concept will continue.

Check this thread for how to create a lock object -

Hope this helps.

ashish

Former Member
0 Kudos

I've create a object, but it seem don't work for my case, so, can i set the lock object which cannot allow access the table (even read data) once the table is locked. Thanks!