我想使用 for 循环将查询中的项目添加到 TListView 中。但是我从 ListViewShifts.Items.Add() 行中收到一条错误消息,提示“实际参数太多”。从查询中添加到列表的正确方法是什么?
Qry := TFDQuery.Create(DBConnection);
Qry.Connection := DBConnection;
Qry.SQL.Text := 'SELECT Count(10) FROM Bookings WHERE NurseNo=:nurseID;';
Qry.Params.ParamByName('nurseID').AsInteger := NurseID;
Qry.Active := True;
//Fill the list view with the shifts that have the nurses ID
for Count := 0 to 10 do
begin
ListViewShifts.Items.Add(Qry.Fields[Count].AsString);
end;