if Confirm('你真的要删除当前节点吗?') and (tv.Selected <> nil) then
begin
tmpStr := GetWhereStr(tv.Selected);
if tmpStr <> '' then {删除节点对应的数据库数据}
begin
ExecSQL('delete * from spbxx where '+ TmpStr);
ExecSQL('delete * from spjbxxb where '+ TmpStr);
end;
Node := tv.Selected;
repeat
Dispose(Node.Data); {清空要删除节点及所有子节点的Data内存数据}
Node := Node.GetNext;
until (Node=nil) or (Node.Level<=tv.Selected.Level);
tv.Selected.Delete;
{刷新从表}
tmrLoadData.Enabled := False;
tmrLoadData.Enabled := True;
end;
end;
function TForm5.GetWhereStr(const ANode: TTreeNode): String;
var
Node: TTreeNode;
begin
Result := '';
if ANode = nil then Exit;
Node := ANode;
repeat
Result := Result + IntToStr(PNodeData(Node.Data)^.ID) + ',';
Node := Node.GetNext;
until (Node=nil) or (Node.Level<=ANode.Level);
if Result <> '' then
begin
Delete(Result, Length(Result), 1);
Result := ' 商品部编码 in ('+Result +') ';
end;
end;
procedure TForm5.N3Click(Sender: TObject); //修改当前节点
var
Text: String;
ID: Integer;
begin
if tv.Selected = nil then Exit;
if not InputQuery('输入','请输入节点的名称:',Text) or (Trim(Text)='') then Exit;
tv.Selected.Text := Text;
<< 上一页 [31] [32] [33] [34] [35] [36] [37] [38] [39] [40] ... 下一页 >>