Record level locking.

Record level locking.

Post by Jame » Sun, 09 Nov 2003 00:31:52

I have posted a question about how to use sql statement to lock a record. I
still don't have any clue. I think I should rephrase my question in order
to get help from you.

How can I lock a record directly from a Delphi program? I'm using SQL
server 6.5 and Delphi 5.

Thanks a lot.


Record level locking.

Post by Ignacio Va » Sun, 09 Nov 2003 01:17:32

3fabba9d$ XXXX@XXXXX.COM ...

You can't, you can only lock it in a query. Try the Books Online and check
the Index for something along the line of "locks".


The strange part isn't so much that he had an accent. No accent was
detectable. It was just sounds and burbs and gurgles coming from him. He
was a like a chubby, old R2-D2.
- La er


Record level locking.

Post by Arthur E.F » Sun, 09 Nov 2003 06:39:03

When you use transaction, any update locks the record until
you commit or rollback data.

You can lock the record using a select statement too, but
only using transaction.

begin transaction
select 1 from table_name where key_field = 'XXX' with holdlock
-- The record is now locked until commit.
-- The record is unlocked again


"James" < XXXX@XXXXX.COM > escreveu na mensagem