You are not logged in.
I have this code that fills a StringGrid with the list of users
u := TSQLAuthUser.CreateAndFillPrepare(Controlador.Database, TInt64DynArray(ids));
stringgrid1.RowCount := u.FillTable.RowCount;
while u.FillOne do
begin
sgUsuarios.Cells[0, u.FillCurrentRow - 2] := IntToString(u.id);
sgUsuarios.Cells[1, u.FillCurrentRow - 2] := u.LogonName;
end;
This code works well, but I think I should use "u.FillCurrentRow - 1".
The constructor TSQLAuthUser.CreateAndFillPrepare set FillCurrentRow to 1, but when I call u.FillOne the FillCurrentRow is incremented.
source code:
function TSQLRecord.FillOne: boolean;
begin
if (self=nil) or (fFill=nil) or (fFill.Table=nil) or
(fFill.Table.fRowCount=0) or // also check if FillTable is emtpy
(cardinal(fFill.FillCurrentRow)>cardinal(fFill.Table.fRowCount)) then
result := false else begin
FillRow(fFill.FillCurrentRow);
inc(fFill.fFillCurrentRow);
result := true;
end;
end;
Is that correct?
Offline