判断ADOQuery数据集中返回数据的情况

来源:互联网 发布:算法设计需要注意什么 编辑:程序博客网 时间:2024/04/27 09:54
ADOQuery.Open;     if   ADOQuery.Eof   then         数据为空   

ADOQuery1.Open;         if   ADOQuery1.IsEmpty   then//没有值,但不是NULL

ADOQuery1.Open;         if   ADOQuery1.RecordCount<=0   then         // 数据为空,没有所要记录

if   ADOQuery1.IsEmpty   then   
          //这个把握大些,不会出错。不依赖于其它的状态,只要ADOQuery1打开了就可以。Is译为是,Empty对为空,联系起来是:是空。       ADOQuery.Open;     //如果在AfterOpen事件里进行了操作,可能会导致判断不准确。     if   ADOQuery.Eof   then1、ADOQuery1.RecordCount   是否为0     2、ADOQuery1.IsEmpty   是否为true     3     if   ADOQuery.bof=ADOQuery.eof   then   没记录           else   有!

原创粉丝点击