Board index » delphi » Delphi 3/Informix Row Locking

Delphi 3/Informix Row Locking

Hi, How do you lock a row(informix online) so other users can't change
the selected record.

I tried select * from table where id = 2 for update but it doesn't seems
to work. Thanks in advance ...

 

Re:Delphi 3/Informix Row Locking


Do you mean changes in DBGrid? Then you have to play with the
dgEditiing-Option and the editormode-Property of the DBGrid.
To prevent changes in a DBEdit, set the read-only property of the DBEdit to
false (i.e. in the OnEnter-Event, where you can check if the user is allowed
to change it.
Another way is to call the Abort-Procedure in the BeforePost-Event of the
TTable, so changes are not written to the database.

HtH

--
Andreas Klein
Remove XXX from my eMail

Jose Reyes schrieb in Nachricht <357508F1.5D961...@home.com>...

Quote
>Hi, How do you lock a row(informix online) so other users can't change
>the selected record.

>I tried select * from table where id = 2 for update but it doesn't seems
>to work. Thanks in advance ...

Re:Delphi 3/Informix Row Locking


You can always open transaction and do an update on the row using the
primary key.
Something like this:

update YourTable set FieldA=FieldA where PKey=TheValue

While the transction is not commited or rolled back the row will be locked,
and someone trying to access or update the row will get an error.

Jose Reyes <rre...@home.com> wrote in article
<357508F1.5D961...@home.com>...

Quote
> Hi, How do you lock a row(informix online) so other users can't change
> the selected record.

> I tried select * from table where id = 2 for update but it doesn't seems
> to work. Thanks in advance ...

Other Threads