This example fills in the parameters of a query from the entries of a list box.
var
I: Integer;
ListItem: String;
begin
for I := 0 to PSQLQuery1.ParamCount - 1 do
begin
ListItem := ListBox1.Items[I];
case PSQLQuery1.Params[I].DataType of
ftString:
PSQLQuery1.Params[I].AsString := ListItem;
ftSmallInt:
PSQLQuery1.Params[I].AsSmallInt := StrToIntDef(ListItem,0);
ftInteger:
PSQLQuery1.Params[I].AsInteger := StrToIntDef(ListItem,0);
ftWord:
PSQLQuery1.Params[I].AsWord := StrToIntDef(ListItem,0);
ftBoolean:
begin
if ListItem = 'True' then
PSQLQuery1.Params[I].AsBoolean := True else
PSQLQuery1.Params[I].AsBoolean := False;
end;
ftFloat:
PSQLQuery1.Params[I].AsFloat := StrToFloat(ListItem);
ftCurrency:
PSQLQuery1.Params[I].AsCurrency := StrToFloat(ListItem);
ftBCD:
PSQLQuery1.Params[I].AsBCD := StrToCurr(ListItem);
ftDate:
PSQLQuery1.Params[I].AsDate := StrToDate(ListItem);
ftTime:
PSQLQuery1.Params[I].AsTime := StrToTime(ListItem);
ftDateTime:
PSQLQuery1.Params[I].AsDateTime := StrToDateTime(ListItem);
end;
end;
end;