Delphi uses recno to locate the current location of the record, which is suitable for small databases.

Source: Internet
Author: User

1. if qrytem. isempty = true then qrytem. recno: =-1; // minimum value: when the data source is opened and the data record set is null. If not empty, recno: = 1;

2. If qrytem. EOF = true then qrytem. recno: = qrytem. recordcount; // maximum value (the data source is not empty)

// When recno = qrytem. recordcount points to the last record, you can execute qrytem. Next again; then qrytem. EOF is true, and the recno value remains unchanged

3. // All qrytem. Close; qrytem. Open; this statement sets the current record position to the beginning of the record set, or the first record. You do not need to execute the qrytem. First Statement.

Qrytem. Open; qrytem. First; // This statement is always true, that is, when the initial record exists and the recno =-1 is not empty, the recno = 1;

Qrytem. Open; If qrytem. bof then // This statement is always true, that is, when the initial record exists and the recno =-1 is not empty, the recno = 1;

 

Eg: // Delphi7 qrytem: tadoquery;

If qrytem. isempty = false then // use the recno attribute to locate the record location

Begin

R: = qrytem. recno;

Qrytem. Close; qrytem. open;

If r <= qrytem. recordcount then qrytem. recno: = R;

End;

 

4. When multiple tables are queried in the left join mode, the required values are displayed. If you modify the value of one of the tables, an error is returned when refresh is used to refresh the table?

In this case, you can use requery (); then you can locate the current record again?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.