Hi guys..

I'm facing a problem in my project. Basically its a small project for a retail store inbound section. The goods come in cartons and the user enters the carton ID in the UI to accept the carton. In the backend the carton details get updated in the table as received. Problem is that when 2 users are concurrently logged in and by mistake enter the same carton ID simultaneously none of them gets an error and the carton details are updated to twice the actual value. how do i avoid this situation?

basically i validate the carton by checking its current status in the db, which will be 'pending recv' if it has not been recvd yet. however the carton ID is being entered twice before the status gets updated. for both the guys the carton gets validated correctly and then a lot of incorrect updates happen. The architecture is client-server, multiple clients, single server.

please suggest some solution for this, i'll see if i can implement it.

Recommended Answers

All 2 Replies

Obviously it's not C++ issue. It's your DBMS issue. Use the DBMS transactions.

True.. i think i'll have to use row-level locks ...

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.