BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

"Record already Locked by this session"

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Paul Carter
Guest





PostPosted: Tue Mar 14, 2006 6:03 pm    Post subject: "Record already Locked by this session" Reply with quote



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





PostPosted: Thu Mar 16, 2006 4:03 am    Post subject: Re: "Record already Locked by this session" Reply with quote



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





PostPosted: Thu Mar 16, 2006 10:03 pm    Post subject: Re: "Record already Locked by this session" Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.