Subject | Key Links and Deleting Records - Request Help |
---|---|
Author | cbmrussn |
Post date | 2002-02-27T18:16:09Z |
Delphi 6.02, IBO4, FB RC2, Win2k.
I have a piece of code that preforms a .locate on my dataset to find
a specific record, delete it, then check to see if there is another
record that meets to requirements of the .locate, delete, ad
infinitum.
The problem is that this code executes through fully the first time
correctly, deleting all the records it needs to. The second time
through this procedure, it dies on the first .delete.
Here's the code that's giving me problems.
var
Index : Integer;
Found : Boolean;
RecordID : String;
begin
Index := 1;
Found := True;
cdm.ShipQuery.Edit;
repeat {until not(found)}
begin
RecordID := ContractNum.Text + '.' + IntToStr(Index);
Found := cdm.ShipQuery.Locate('Ship_ID', RecordID,
[loCaseInsensitive]);
if Found then
cdm.ShipQuery.Delete;
Index := Index + 1;
end;
until not(Found);
end;
Thanks,
Russ Newcomer
I have a piece of code that preforms a .locate on my dataset to find
a specific record, delete it, then check to see if there is another
record that meets to requirements of the .locate, delete, ad
infinitum.
The problem is that this code executes through fully the first time
correctly, deleting all the records it needs to. The second time
through this procedure, it dies on the first .delete.
Here's the code that's giving me problems.
var
Index : Integer;
Found : Boolean;
RecordID : String;
begin
Index := 1;
Found := True;
cdm.ShipQuery.Edit;
repeat {until not(found)}
begin
RecordID := ContractNum.Text + '.' + IntToStr(Index);
Found := cdm.ShipQuery.Locate('Ship_ID', RecordID,
[loCaseInsensitive]);
if Found then
cdm.ShipQuery.Delete;
Index := Index + 1;
end;
until not(Found);
end;
Thanks,
Russ Newcomer