Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Lock Table before Adding record

Status
Not open for further replies.

Mike2020

Programmer
Mar 18, 2002
55
0
0
US

Hi,


I get into a problem that, 2/more users enter a record into a parent table, then get the the PR from the parent table, and add the record into a child table. After adding the record. one of the user's record will get all the child records, and the other have no child record.

I wonder is anyway we can lock the table, not the record, and add record into the table and unlock it.

Thanks.....

Mike
 
By the way, this is web base using ADO.
 
Do you want there to be two parent records? It sounds to me like there's a problem with the database design, that parent records aren't being identified by a unique key. How is it that you get two parent records? Why doesn't the submission of the second one fail?

I don't suspect that locking your table is going to be your solution.
 

the parent records is unique key, PK.
The each person enter a record, there is one record for the parent, and one for the child and the child record need to have FK of the parent's PK.

The problem is that
two records of the child table get the same FK of the parent.

 
Hmm, I admit that I don't understand that.

Person A creates a parent, PK 100001.

Person B creates a parent, PK 100002.

Person A creates a child of PK 100001.

Person B creates a child of PK 100002.

Where does it go wrong? When A and B are creating the children, are they reselecting the parents or something? If so, how do they end up selecting the same parent PK?
 

Thanks...

Actually, I just found out what wrong with it.
I use the same Variable like SQLquery, over and over.
I didn't have this problem before in other db. But some how the ORACLE doesn't like it. So the problem occurred.

SQLquery = "INSERT INTO TABLE..."

Thanks Anyway...

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top