Article View: borland.public.cppbuilder.database.multi-tier
Article #440Unwanted: Error 'Too many record locks on table'
From: Ian Broadhurst
Date: Fri, 19 Oct 2001 13:48
Date: Fri, 19 Oct 2001 13:48
47 lines
2416 bytes
2416 bytes
I have a client/server application where the clients use data-aware
controls (TDBGrid etc) and TClientDataSets, and the server uses a
TClientDataSet (used for all providers called cdsInternalUpdate),
TProviders and TTables inside a TDataModule. The database tables are
of type dBASE with a level of 4.
When a user deletes a record from the control, the server deletes the
record from the database table using for following:
int MyVal = iSomePassedInId;
cdsInternalUpdate->ProviderName = 'Provider1';
cdsInternalUpdate->Open();
if (cdsInternalUpdate->Locate('ID', MyVal, Opts))
{
cdsInternalUpdate->Delete();
cdsInternalUpdate->ApplyUpdates(0); //calls
Provider1AfterUpdateRecord
}
In the Provider1AfterUpdateRecord method, I remove all related records
from other tables and log the record change to a log file. I remove
the records from the tables directly like so:
String OldIdx =Table2->IndexName;
Table2->IndexName = 'ID';
if (Table2->Locate('ID', MyVal, Opts))
{
while (!Table2->Eof &&
Table2->FieldByName('ID')->AsInteger ==MyVal)
{
Table2->Delete();
}
}
It is here that I get the error 'Too many record locks on table'. I
believe that it occurs during the Table2->Locate() or Table2->Delete()
method. This occurs when using one client connected to the server.
Any suggestions???
Are you allowed to access a TTable from within an AfterUpdate method?
Is there anything fundamentally wrong with the way in which I have
gone about this?
All help greatly appreciated!
Ian Broadhurst
Technical Details
Message-ID:
<a0d349be.0110190548.2ee4ae9d@posting.google.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcd2b,c855b78c516b429b,start X-Google-Attributes: gidfcd2b,public X-Google-ArrivalTime: 2001-10-19 06:48:21 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail From: ian.broadhurst@dtrack.com (Ian Broadhurst) Newsgroups: borland.public.cppbuilder.database.multi-tier Subject: Unwanted: Error 'Too many record locks on table' Date: 19 Oct 2001 06:48:21 -0700 Organization: http://groups.google.com/ Lines: 47 Message-ID: <a0d349be.0110190548.2ee4ae9d@posting.google.com> NNTP-Posting-Host: 62.189.167.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1003499301 14225 127.0.0.1 (19 Oct 2001 13:48:21 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 19 Oct 2001 13:48:21 GMT