老
老鳖
Unregistered / Unconfirmed
GUEST, unregistred user!
procedure Tmxinput.ToolButton9Click(Sender: TObject);
var
fatherid:array[0..20] of string;
num,i:integer;
begin
dbgrid2.Visible:=true;
dbgrid1.Visible:=false;
if query1.Active=true then
begin
query1.Close;
query1.SQL.Clear;
//query1.SQL.Add('select distinct count(上一级) as number from zgsb');
query1.SQL.Add('select distinct 上一级 from zgsb');
query1.Active:=true;
query1.Open;
num:=query1.RecordCount;
for i:=0 to (num-1) do
begin
query1.First;
repeat
begin
fatherid:=query1.FieldValues['上一级'];
query1.Next;
end;
until query1.Eof;
end;
end;
for i:=(num-1) to 0 do
begin
if query1.locate('上一级',fatherid,[locaseinsensitive]) then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.Add('select sum(建筑费) from zgsb');
query1.SQL.Add('where 上一级=:str');
query1.ParamByName('str').Value:=fatherid;
end
else
begin
messagedlg('记录未找到',mterror,[mbok],0);
exit;
end;
query1.Open;
query1.Edit;
query1.Post;
end;
end;
var
fatherid:array[0..20] of string;
num,i:integer;
begin
dbgrid2.Visible:=true;
dbgrid1.Visible:=false;
if query1.Active=true then
begin
query1.Close;
query1.SQL.Clear;
//query1.SQL.Add('select distinct count(上一级) as number from zgsb');
query1.SQL.Add('select distinct 上一级 from zgsb');
query1.Active:=true;
query1.Open;
num:=query1.RecordCount;
for i:=0 to (num-1) do
begin
query1.First;
repeat
begin
fatherid:=query1.FieldValues['上一级'];
query1.Next;
end;
until query1.Eof;
end;
end;
for i:=(num-1) to 0 do
begin
if query1.locate('上一级',fatherid,[locaseinsensitive]) then
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.Add('select sum(建筑费) from zgsb');
query1.SQL.Add('where 上一级=:str');
query1.ParamByName('str').Value:=fatherid;
end
else
begin
messagedlg('记录未找到',mterror,[mbok],0);
exit;
end;
query1.Open;
query1.Edit;
query1.Post;
end;
end;