//轮到我出手了,^_^
procedure TForm1.Button1Click(Sender: TObject);
var
I : Integer;
v : Variant;
D : Integer;
DataSource : TDataSource;
begin
for I := 0 to ComponentCount-1do
begin
v :=GetPropValue(Components,'DataSource');//检索组件有没有datasource属性
if (not VarIsEmpty(V)) and (not VarIsNull(V)) then
begin
D := v;
Integer(DataSource) := D;
DataSource.DataSet.Open ;
end;
end;
end;