Board index » delphi » BDE error Record/Key Deleted BDE-Error:8708

BDE error Record/Key Deleted BDE-Error:8708

I don't understand this message, and can find no documentation on it.

This occurred in (I thought working code) when I deleted all the data
in three related tables, and tried to insert new data.  Basically I
set the SQL statement, open the table, place in insert mode, set all
the values and do a post.

When the post occurs, the error Record/Key Deleted is generated
(Category:34, ErrorCode:8708, Subcode:4).
If I ignore this error code, the database entry appears correct as I
observe with the ISQL utility.

The only problem is that the insert runs a trigger which uses a
generator to generate a unique  JobID.  Although this
appears to work (ISQL), the AutoRefresh does not get/set the new
JobID back into the dataset, nor does a manual refresh get the JobID.

Code Example follows:

DM1->JobQ->SQL->Add("Select * from JOBQUEUE");
DM1->JobQRECORDER->Value = Max + 100;
DM1->JobQQUETIME->Value    = StrToDateTime(Now());
DM1->JobQSYSID->Value    = 1;
DM1->JobQBATCHNUMB->Value   = bh->BatchID;
DM1->JobQBATCHWEIGHT->Value   = BWeight;
DM1->JobQLIQUORVOLUME->Value  = BVolume;
DM1->JobQJOBSTATE->Value      = BJS_INIT;         // see MiscCode.h
DM1->JobQCOMMENT->Value       = bh->Comment;
DM1->JobQRECIPE->Value       = bh->FormulaName;
DM1->JobQPRONAME->Value       = bh->ProcedureName;
DM1->JobQRGB1->Value       = bh->Red;
DM1->JobQRGB2->Value          = bh->Green;
DM1->JobQRGB3->Value          = bh->Blue;
DM1->JobQMACHNUMB->Value      = bh->MachineNumb;
DM1->JobQRECIPEID->Value      = bh->FormulaID;


catch(EDBEngineError &x)
    {  int i,j,k,l;
    i = x.Errors[0]->Category;
    j = x.Errors[0]->ErrorCode;
    k = x.Errors[0]->NativeError;
    l = x.Errors[0]->SubCode;

x = DM1->JobQJOBID->Value;  // Value here is 0, this does not update.
                                                // the value observed by
ISQL is correct.

Thanks in advance to anyone able to lend a hand here.......Tim C.


Re:BDE error Record/Key Deleted BDE-Error:8708

The problem is that the BDE tries to reread the record after it is posted.
Unfortunately when the BDE tried to post the record the primary key was null
so it cannot find the record it just posted hence the error.

The best solution is to write a stored procedure that returns the next value
from the generator. Call the stored proc from the OnNewRecord event of your
dataset and assign the returned value to the primary key there. Change your
trigger so it only assigns a valut to the primary key if the primary key
value is null.


Other Threads