Maybe something like:

with tquery.create(nil) do begin
  databasename := ...;
  sql.add('select id from thetable where id = '+intotostr(theid));
  open;
  if recordcount > 0 then ...
  ...
  close;
  free;
end;

Steve.


> -----Original Message-----
> From: Leo Ramakers [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 6 October 1999 15:52
> To: Multiple recipients of list database
> Subject: [DUG-DB]: Testing if a Pardox record exists without 
> moving the
> cursor
> 
> 
> Is there a way to test if a record exists without moving the 
> table cursor?
> 
> I have a number of paradox tables, each with an index field. 
> I have an even
> handler on the related dataset OnStateChange which tests if 
> the state is
> DSInsert, and if so it calls a generic 'NewRecord' handler. 
> This emulates the
> behaviour of the (otherwise buggy) autoincrement field, it 
> reads a control
> counter, increments and saves it, and I use the new value for 
> the new record. I
> am trying to manage the situation when the counter wraps 
> around to the start
> number again, I want to test if a record of that number 
> exists, and if so,
> increment and try again. I dont want to move the cursor for 
> fear of upsetting
> the insert process.
> 
> Leo Ramakers
> Soft Option
> 
> 
> 
> --------------------------------------------------------------
> -------------
>   New Zealand Delphi Users group - Database List - 
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> 
---------------------------------------------------------------------------
  New Zealand Delphi Users group - Database List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to