 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Paul Carter Guest
|
Posted: Tue Mar 14, 2006 6:03 pm Post subject: "Record already Locked by this session" |
|
|
Using Delphi Pro 7
Have an SQL table open via BDE in Cached update mode.
Have a save button which tries to edit and post each record from last to
first e.g.
With Dataset do begin
FindLast;
For Counter := 1 to RecordCount do begin
If not (state in [dsEdit, dsInsert]) then Edit;
FieldByName('FollowUpID').Value := PriorActID;
with FieldByName('ActivityID') do
If AsInteger < 0 then begin
FieldByName('ActivityID').Value := NextActID;
NextActID := NextActID - 1;
end;
PriorActID := FieldByName('ActivityID').AsInteger;
Post;
FindPrior;
end;
ColdCallQuery.ApplyUpdates;
end;
When > 1 activity, on second pass through loop get the error "record already
locked by user"
Any ideas?
Thanks in advance.
Paul. |
|
| Back to top |
|
 |
Oliver Townshend Guest
|
Posted: Thu Mar 16, 2006 4:03 am Post subject: Re: "Record already Locked by this session" |
|
|
| Quote: | When > 1 activity, on second pass through loop get the error "record
already locked by user"
Any ideas?
|
I assume your problem comes about because some field is changing which
causes the record to be read twice? Why do you do it backwards by the way?
Oliver Townshend |
|
| Back to top |
|
 |
Oliver Townshend Guest
|
Posted: Thu Mar 16, 2006 10:03 pm Post subject: Re: "Record already Locked by this session" |
|
|
You'd be better off replying on the newsgroup, someone else might answer, so
I'm posting here.
Anyway, my answer would be that the Find routines you are using may re-sort
the records during your scan if you are altering the primary key (or
whatever key you are using for Find). But that's just a guess
Oliver Townshend
-----Original Message-----
Subject: Re: "Record already Locked by this session"
Hi Oliver
The field I am changing is not tied to any events, so I am having difficulty
understanding exactly what is going on.
The records themselves are activities for a CRM database, and the reason I
go backwards is that each record has a FollowUpID that points to the record
proceeding it. Hence I go to the last record and go backwards through the
database recording the proceeding Activity ID and putting in the prior
record's FollowUpID field.
The strange thing is that I can update as many records as has been entered,
but as soon as I reach the first record it seems to be locked.
I have tried going forwards, but the error occurs on the first pass - again
the first record.
Best regards
Paul. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|