Subject Re: [IBO] Key Links and Deleting Records - Request Help
Author Jason Wharton
It should work and I am interested in why it isn't. What appears to be the
exact problem? What do you mean that it dies on the first delete of the 2nd
pass?

But, I must also say there are much better ways to do this with a
client/server database. How about doing a single DELETE statement with the
WHERE clause specifying what all records should be deleted. Then, just
refresh the dataset after this statement is executed.

HTH,
Jason Wharton
CPS - Mesa AZ
http://www.ibobjects.com


----- Original Message -----
From: "cbmrussn" <russn@...>
To: <IBObjects@yahoogroups.com>
Sent: Wednesday, February 27, 2002 11:16 AM
Subject: [IBO] Key Links and Deleting Records - Request Help


> 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
>
>
>
>
___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or
InterBase
> without the need for BDE, ODBC or any other layer.
>
___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info
papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>