begin
if dm_base.qryDepartment.RecordCount<>0 then
begin
with dm_base.qryDepartment do
begin
close;
sql.Clear;
sql.Add('select * from syst_Department where state<2');
open;
if dm_base.qryDepartment.Locate('deptuid',dm_base.qryEmployee.Fieldbyname('deptid').AsInteger,[]) then
begin
application.MessageBox('此部门下有员工不能删除',gstrTitl,MB_ICONERROR+MB_OK);
abort;
end;
end;
if application.MessageBox('真的要删除吗?',gstrTitl,mb_iconquestion+mb_yesno)=idyes then
begin
with dm_base.qrydepartment do
begin
edit;
fieldbyname('state').AsInteger :=2;
post;
end;
end;
end
else
application.MessageBox('请选中部门',gstrTitl,mB_ICONERROR+MB_OK);end;
if dm_base.qryDepartment.RecordCount<>0 then
begin
with dm_base.qryDepartment do
begin
close;
sql.Clear;
sql.Add('select * from syst_Department where state<2');
open;
if dm_base.qryDepartment.Locate('deptuid',dm_base.qryEmployee.Fieldbyname('deptid').AsInteger,[]) then
begin
application.MessageBox('此部门下有员工不能删除',gstrTitl,MB_ICONERROR+MB_OK);
abort;
end;
end;
if application.MessageBox('真的要删除吗?',gstrTitl,mb_iconquestion+mb_yesno)=idyes then
begin
with dm_base.qrydepartment do
begin
edit;
fieldbyname('state').AsInteger :=2;
post;
end;
end;
end
else
application.MessageBox('请选中部门',gstrTitl,mB_ICONERROR+MB_OK);end;
解决方案 »
- 每隔1秒显示一个字的程序怎么写?
- 使用socketconnection连接时怎么使用simpleobjectbroker在程式运行时改变服务器
- 菜鸟请各位高手帮忙!关于中值滤波去噪点,锐化和查找边界的方法!
- 跪求 发送EMAIL 的原码或例子,谢谢!!!
- 局域网中如何截取数据分包???
- (菜鸟问题)treeview的一个node用edittext以后怎么样获取修改后的text?
- 删除一条记录时出现错误,怎么处理
- 书上说检索字段和计算字段可以配合起来用,可我。。。。
- 2个Dataset如何合并?3个呢?
- 为什么我对数据库进行操作时,总是出现"Table is busy"的错误信息?我用Query和Paradox数据表!
- 可用分又多了不少,想学葛朗台,可是坚持不住了,进来吧,都给你们算了....
- 怎么办,我很受刺激...
在select语句直接加上另外一个where的条件
'deptuid='+dm_base.qryEmployee.Fieldbyname('deptid').AsInteger
比用Location快多了吧.