我访问存储过程数据集(MS SQL Server,仅向前,只读)的大部分代码是多年前我的Clipper编码的后备
在今天的代码审查中,我注意到在类似的代码块中引用了IsEmpty.这仅仅是一个偏好还是在示例场景中是否有任何真正的区别?
MyStoredProc.Open;
if not MyStoredProc.IsEmpty then
begin
DoSomething;
end;
Run Code Online (Sandbox Code Playgroud)
我经常使用的地方
MyStoredProc.Open;
if not MyStoredProc.Eof then
begin
DoSomething;
end;
Run Code Online (Sandbox Code Playgroud)
主要是因为它反映了我在while循环中使用的实践,当它是多个记录时:
MyStoredProc.Open;
while not MyStoredProc.Eof then
begin
DoSomething;
MyStoredProc.Next;
end;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6031 次 |
| 最近记录: |