Dear Friends
i have an application using Oracle10g as backend database and visual Basic 2008 front end tool. my problem is i have one application where more thn one user are working on a particular form and when a button, named proceed, pressed it generate next number and stored in the database. the problem is sometimes more thn one user presses the button from different location and sometimes two users get same number allocation. how to shorted it out so that even more than one user press the button at a time it will give unique number to each user.

Is the number being allocated by the database? If yes then you can use transactions to lock the rows in the table being used until each user is finished with it. Transaction allow only one user at a time to access the information to prevent dirty reads and the like, sequent users queue awaiting their turn to access the database so problems like yours are resolved.

well in the first instance, probably the number should be generated by the database.
secondly, this field should have an index indicating no duplicates, eg the primary key, then there is not this situation can occur

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.