Check if I have data in the query, when giving the next or prior

Asked

Viewed 134 times

-1

I have a query in Delphi, where I give the command next and prior, only I can’t check if it’s my first or last record, what I want specifically is, when pressing the next button, check if it’s my last item in the list and vice versa; I’m using the Fdquery piece, Tdatasource and mysql and firedac,
Taking advantage of the hook, I wanted to know how I do to check if, the moment I register a new data, if this data has already been registered, thank you and sorry if it got confused.

1 answer

2


To know if it is the first or last record is to use the functions dataset.bof (Begin Of File, file start) and dataset.eof (End Of File, end of file)

So typically the loop of a dataset is like this:

dataset.first;
while not dataset.eof do
begin
   //
   dataset.next;
end;
  • Thank you worked, and could you help me with the second part? When I register a new data, how do I check if it already exists in my bank?

  • this might as well create another post. It depends on your table, primary keys, etc....

Browser other questions tagged

You are not signed in. Login or sign up in order to post.