ADOQuery1.Connection:=ADOconnection1;
with ADOQuery1 do
begin
Close; ////////////////
SQL.Clear; ////////////////
SQL.Add('Select Distinct username From USERINFO');
Active:=True;
While Not Eof do
begin
do somethings;
Next;
End;
active:=False;
end;
with ADOQuery1 do
begin
Close; //////////////
SQL.Clear; //////////////
SQL.Add('Select Distinct deptname From deptINFO');
Active:=True;
While Not Eof do
begin
do somethings;[第二次使用的数据]
Next;
End;
active:=False;
end;
with ADOQuery1 do
begin
Close; ////////////////
SQL.Clear; ////////////////
SQL.Add('Select Distinct username From USERINFO');
Active:=True;
While Not Eof do
begin
do somethings;
Next;
End;
active:=False;
end;
with ADOQuery1 do
begin
Close; //////////////
SQL.Clear; //////////////
SQL.Add('Select Distinct deptname From deptINFO');
Active:=True;
While Not Eof do
begin
do somethings;[第二次使用的数据]
Next;
End;
active:=False;
end;
SQL.Add('Select Distinct username From USERINFO');
sql.clear;
sql.add()
sql.open
就可以了