Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

record unlock error

4 posts in Delphi Last posting was on 2003-09-03 20:49:17.0Z
Jim Martin Posted on 2003-09-03 14:01:36.0Z
Reply-To: "Jim Martin" <jmartin@offshoredata.com>
From: "Jim Martin" <jmartin@offshoredata.com>
Newsgroups: advantage.delphi
Subject: record unlock error
Date: Wed, 3 Sep 2003 07:01:36 -0700
Lines: 16
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 12.215.153.17
Message-ID: <3f55f4b9@solutions.advantagedatabase.com>
X-Trace: 3 Sep 2003 08:03:37 -0700, 12.215.153.17
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!12.215.153.17
Xref: solutions.advantagedatabase.com Advantage.Delphi:13850
Article PK: 1107286

Howdy . . .

I'm getting an error "An unlock was issued for a record with no current
lock."

I am using some Delphi example code to get information from selected rows of
a dbGrid, that are typical Purchase Order line items. I do NOT get the
error when I originally create a PO; only when I go back into a PO and
select more than one row while in Edit mode.

I can submit the code if it helps, but though perhaps this error is usually
symtomatic of a common cause.

Thanks for any assistance -- Jim


Karl Perry Posted on 2003-09-03 14:15:12.0Z
From: "Karl Perry" <kaperry@NOSPAMcablespeed.com>
Newsgroups: advantage.delphi
References: <3f55f4b9@solutions.advantagedatabase.com>
Subject: Re: record unlock error
Date: Wed, 3 Sep 2003 07:15:12 -0700
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 64.122.99.34
Message-ID: <3f55f849@solutions.advantagedatabase.com>
X-Trace: 3 Sep 2003 08:18:49 -0700, 64.122.99.34
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!64.122.99.34
Xref: solutions.advantagedatabase.com Advantage.Delphi:13851
Article PK: 1107287

Jim,

This is a logic error in your code. Trace through your edit code, looking
at all events that are fired while in the grid, and you should find it.

Karl Perry

"Jim Martin" <jmartin@offshoredata.com> wrote in message
news:3f55f4b9@solutions.advantagedatabase.com...
> Howdy . . .
>
> I'm getting an error "An unlock was issued for a record with no current
> lock."
>
> I am using some Delphi example code to get information from selected rows
of
> a dbGrid, that are typical Purchase Order line items. I do NOT get the
> error when I originally create a PO; only when I go back into a PO and
> select more than one row while in Edit mode.
>
> I can submit the code if it helps, but though perhaps this error is
usually
> symtomatic of a common cause.
>
> Thanks for any assistance -- Jim
>
>


Jim Martin Posted on 2003-09-03 18:46:30.0Z
Reply-To: "Jim Martin" <jmartin@offshoredata.com>
From: "Jim Martin" <jmartin@offshoredata.com>
Newsgroups: advantage.delphi
References: <3f55f4b9@solutions.advantagedatabase.com> <3f55f849@solutions.advantagedatabase.com>
Subject: Re: record unlock error
Date: Wed, 3 Sep 2003 11:46:30 -0700
Lines: 47
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 12.215.153.17
Message-ID: <3f563786@solutions.advantagedatabase.com>
X-Trace: 3 Sep 2003 12:48:38 -0700, 12.215.153.17
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!12.215.153.17
Xref: solutions.advantagedatabase.com Advantage.Delphi:13863
Article PK: 1107299

Hi Karl:

Perhaps I'm trying to do something I can't do via a dbGrid. (FWIW, this is
local server only) I display a PO's line items in a dbGrid, and want the
user to be able to multi-select a couple of lines; then when they pick an
account via another control, it will sum the value of a specified cell in
each of the selected rows, and while walking through the selected rows will
modify the line item's account field to reflect which account the line item
was assigned to.

It gets the unlock error on the GoToBookmark line the second time the
GoToBookMark line is attempted, below, and I can only assume the bookmarks
are being trashed or something.

What I don't understand is why this works fine when the PO is created
originally, but blows up on the bookmark line when this routine is run in
"edit mode." I totally agree-- it makes it seem like there is something
about my edit mode that is different than the PO creation. But for this line
item selection process there is not really supposed to be anything different
between "new" and "edit" , and I have tested the states of all known objects
that have anything to do with this process, and they are the same when this
particular routine gets run.

This code snippet has been trimmed to be an example, but does blow up on the
GoToBookmark

if DBGrid1.SelectedRows.Count > 0 then begin
with DBGrid1.DataSource.DataSet do begin
for i:=0 to DBGrid1.SelectedRows.Count-1 do begin
GotoBookmark(pointer(DBGrid1.SelectedRows.Items[i]));
edit;
linesCost := linesCost + Fields[fieldNdx].asFloat;
fieldByName('AccNo').asInteger := AccNo;
post;
end;
end;
end;

This is code I borrowed from online help for TdbGrid, except I added the
field modification.

Thanks for any comments. I'll try to better understand what goes on behind
the scenes with bookmarks and a dbGrid connected to an Advantage dataset.

Jim


Jim Martin Posted on 2003-09-03 20:49:17.0Z
Reply-To: "Jim Martin" <jmartin@offshoredata.com>
From: "Jim Martin" <jmartin@offshoredata.com>
Newsgroups: advantage.delphi
References: <3f55f4b9@solutions.advantagedatabase.com> <3f55f849@solutions.advantagedatabase.com>
Subject: Re: record unlock error
Date: Wed, 3 Sep 2003 13:49:17 -0700
Lines: 7
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 12.215.153.17
Message-ID: <3f565450@solutions.advantagedatabase.com>
X-Trace: 3 Sep 2003 14:51:28 -0700, 12.215.153.17
Path: solutions.advantagedatabase.com!solutions.advantagedatabase.com!12.215.153.17
Xref: solutions.advantagedatabase.com Advantage.Delphi:13865
Article PK: 1107302

I have completely changed how I access and modify the line item data
selected by a user. Still don't understand why the other code worked only
part of the time, but have other battles . . .

Thanks for your help-- Jim