当DBGrid中的所有行被删除后,如何判断DBGrid中已无行可删,防止继续删除?(100分)

  • 主题发起人 daniel_sun
  • 开始时间
D

daniel_sun

Unregistered / Unconfirmed
GUEST, unregistred user!
if query.recordcount>0 then
query.delete
 
同意楼上,或if not query.isempty then
 
if dbgrid.datasource.dataset.isempty then
begin
showmessage('無行可刪除!');
abort;
end;
 
同意zxb200,
判断recordcount>0 不行的
 
所有行都没了,你还删除什么?
有什么好判断
if messagedlg('确定要删除所选的记录?',mtConfirmation,[mbyes,mbno],0)= mryes then
with DBGrid1.datasource.datasetdo
begin
First;
While not eofdo
begin
if DBGrid1.SelectedRows.CurrentRowSelected then
Delete
else
Next;
end;
showmessage('删除完毕!');
end;
 
删除时作判断,同时每次删除后刷新dbgrid
 
同意zxb200,
判断recordcount>0 不行的
 

Similar threads

S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
965
SUNSTONE的Delphi笔记
S
S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
1K
SUNSTONE的Delphi笔记
S
顶部