How can we determine whether the number of records in the adoquery dataset is null, that is, whether there is data in the dataset?

Source: Internet
Author: User
How can we determine whether the number of records in the adoquery dataset is null, that is, whether there is data in the dataset? Delphi/Windows SDK/API
Http://www.delphi2007.net/DelphiDB/html/delphi_20061221094018194.html
RT

Adoquery. open;
If adoquery. EOF then
Data is empty

Adoquery1.open;
If adoquery1.isempty then

Adoquery1.open;
If adoquery1.recordcount <= 0 then data is empty

Adoquery1.open;
If adoquery1.isempty then
Positive Solution

Recordcount cannot be used as the judgment condition.

If adoquery. EOF then
And
If adoquery1.isempty then
Which of the two is better?

If adoquery1.isempty then is more advanced and will not cause errors. It does not depend on other States, as long as adoquery1 is enabled. The empty pair is empty. The link is empty.
Adoquery. open;
// If an operation is performed in the afteropen event, the judgment may be inaccurate.
If adoquery. EOF then

1. Whether adoquery1.recordcount is 0
2. Whether adoquery1.isempty is true
3 if adoquery. bof = adoquery. EOF then is not recorded
Else!

Related Article

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.