
record locking while insert new record??
I wonder if anyone can help me on this I am using VB6 and SQL 7.0. What I
try to
do is lock a record and also block other from reading that record in one
table
while inserting a new record in another table.
Example : I have 2 tables, Table1 and Table2. Table1 have a few records
which use to store running number. Table2 is use for storing invoice data.
During each insertion of new invoice record to Table2, I need to get the
running number for the invoice from Table1 which then will be use for
inserting new record in Table2 and I will then increment the invoice running
number by 1 in Table1. How can I block the running number of invoice in
Table1 from read by others as soon as I read it until I commit the
transaction. I only want to lock the invoice running number record in Table1
not the whole table. Can it be done? Thanks in advance.