procedure TfrmPlayers.btnPlayersClick(Sender: TObject);
var
i: integer;
begin
memoPlayers.Clear;
with dbgPlayers do
begin
for i := 0 to FieldCount-1 do
begin
memoPlayers.Lines.Add(Fields[i].AsString);
end;
end;
end;
我找到了输出第一行中所有列的解决方案。 但是我想让它在某一列下输出所有行。
答案 0 :(得分:0)
您需要遍历所有行(如注释中提到的@BugFinder)。您可能会考虑包括两个附加步骤:
TBookMark
进行导航。DisableControls
插入数据时禁用数据显示。示例(根据您的代码):
procedure TfrmPlayers.btnPlayersClick(Sender: TObject);
var
i: integer;
b: TBookMark;
begin
// Clear existing data
memoPlayers.Clear;
// Get the data
b := dbgPlayers.GetBookmark;
dbgPlayers.DisableControls;
try
dbgPlayers.First;
while not dbgPlayers.Eof do begin
for i := 0 to dbgPlayers.FieldCount-1 do begin
memoPlayers.Lines.Add(dbgPlayers.Fields[i].AsString);
end{for};
dbgPlayers.Next;
end{while};
finally
if dbgPlayers.BookmarkValid then dbgPlayers.GotoBookmark(b);
dbgPlayers.FreeBookmark(b);
dbgPlayers.EnableControls;
end{try};
end;