Subject RE: [IBO] Key Links and Deleting Records - Request Help
Author Russ Newcomer
>Based on your and Helen's advice, I changed my code to the following :
> With cdm.Shipdelete do
> begin
> If not Prepared then Prepare;
> Params[0].AsString := ContractNum.Text + '.';
> Execute;
> end;
> cdm.ShipQuery.Refresh;
>Now, when this code executes a second time (it's an on-exit event for a
>box, second time is the second time you leave the box), an error message
>comes back to me :
>ISC ERROR CODE : 335544665
>There's some more to it, and I can post that also if needed.
>I'm using a generator to create my primary key, and I wonder if that's part
>of the problem?

It certainly looks as if you haven't provided enough information. I'm at a
loss to know why you are getting a key violation on a delete
operation! Well, you just wouldn't, so there is something you are not
telling us.

Also, if that manufactured key is not the primary key, then that delete
won't work, unless the manufactured key is also unique.

Tell us more...


This code is called during an operation to, as you can see, go through the
database to delete all the records in a database where the key matches. The
records are shipping records, and they're a subset of a contract number.
The contract number is generated by the generator, then the . and the number
are added (there are multiple shipments per contract) The user is not
involved in selecting these unique keys. The way the program works is if
the user decides to modify the ammount of the contract to ship, the program
goes through the database and deletes all the shipments, and then re-creates
a new, single shipment record. My code runs fine the first time, everything
works the way that it is supposed to. The records are deleted, new one
created, etc, etc. However, if I run this code again, it gives me that Key

Upon further investigation, I've found that when it recreates that new,
single shipment record, and it calls TIBOQuery.Post is when this error
occurs. The reason it errors is because the code I've previously posted
doesn't delete the records (any of them, whether there is just one or
multiple records to delete) the second time through. I'm at a loss on why,
is there some sort of clear I need to do to the DSQL before I can run it

Russ Newcomer

[Non-text portions of this message have been removed]