declare @count int
declare @Superior varchar(20)
declare @countNum int
declare CustCursor Cursor for
select superior,count(superior) as RecordeCount
from [stuff]
group by Superior
for read only
open custcursor
set @count=0
while (1=1)
begin
Fetch Next
from CustCursor
into @Superior,@CountNum
print @Superior
print @countNum
if(@@FETCH_STATUS <>0)
begin
break;
end
select * From [stuff]
where superior=@Superior
Set @count=@count+1
end
close custcursor
deallocate custcursor
above is the SQL statement,and How to get multi-dataset use
TADOQuery,please!Thanks!
TAdoQuery has a NextRecordSet method that allows you to move from one recordset to the next. See the help documentation for TAdoQuery.NextRecordSet for more details. Hope this helps :)
I know the TADOQuery's NextRecordSet,but I can't use it correctly
Could you give me some code !
Drop an ADODataSet component on the form and then do this to move to the next record set:
while true do
begin
ADODataSet1.Recordset := ADOQuery1.NextRecordset;
if ADODataSet1.IsEmpty then
Break;
while not ADODataSet1.Eof do
begin
// Move thru the record set.
ADODataSet1.Next;
end;
end;
Note that I typed that code off the top of my head, so you may need to make some minor adjustments. Hope this helps :)