Oder suchst Du sowas? (nicht getestet)
Delphi-Quellcode:
var
myComp : TComponent;
begin
while not qry.Eof Do begin
myComp := FindComponent(Format('Panel%d',[qry.FieldByName('Spalte1').AsInteger]));
if Assigned(myComp) and (myComp is TPanel) then begin
TPanel(myComp).Caption := qry.FieldByName('Spalte2').AsString;
end;
qry.Next;
end;
end;