Board index » delphi » Checking if other ttable edit a record

Checking if other ttable edit a record

Hi,

I have two TTables connected to the same physical table, TTable1 is editing
or inserting a specific record in this table.  If I loop through all the
records in the same table with TTable2, how can I detect if / which record
is edited/inserted by TTable1?

Thanks for any help on this issue

Regards

Tor

 

Re:Checking if other ttable edit a record


An inserted record does not exist in the table until the TTable that
inserted it Posts it. Until posted the record exists only in memory.
Detecting whether a record is being changed may or may not be possible. It
depends on what database you are using.

Bill

--
Bill Todd
(Sorry but TeamB cannot answer questions received via email)
(Remove nospam from my email address to contact me for any other reason)

Re:Checking if other ttable edit a record


Quote
>I have two TTables connected to the same physical table, TTable1 is editing
>or inserting a specific record in this table.  If I loop through all the
>records in the same table with TTable2, how can I detect if / which record
>is edited/inserted by TTable1?

The inserted record isn't in the table yet so you won't see it in table2
For Paradox and dbase tables you can try editing each record.  If the Edit fails
that record is being edited in the other table.

--
Brian Bushay (TeamB)
Bbus...@NMPLS.com

Re:Checking if other ttable edit a record


On Fri, 15 Jan 1999 20:10:10 +0100, "Tor Tveitane" <bush...@online.no>
wrote:

Quote
>I have two TTables connected to the same physical table, TTable1 is editing
>or inserting a specific record in this table.  If I loop through all the
>records in the same table with TTable2, how can I detect if / which record
>is edited/inserted by TTable1?

Tor,

If you're using local tables, you can check if a record is being
edited by Table1 via Table2 with this code:
    Table2.UpdateCursorPos;
    DbiIsRecordLocked(Table2.Handle, IsLocked);

If IsLocked is True after the call, the record is being edited by
another table in the same session.

One word of warning though.  If you use two TTable components in the
same session on the same table, you can have the problem of one TTable
releasing a record lock placed by the other.  See the thread titled
"TTable object removeing a record lock from other, diffferent,  TTable
object."

HTH

Jan

Other Threads