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 MySQLQuery1.ParamCount - 1 do
begin
ListItem := ListBox1.Items[I];
case MySQLQuery1.Params[I].DataType of
ftString:
MySQLQuery1.Params[I].AsString := ListItem;
ftSmallInt:
MySQLQuery1.Params[I].AsSmallInt := StrToIntDef(ListItem,0);
ftInteger:
MySQLQuery1.Params[I].AsInteger := StrToIntDef(ListItem,0);
ftWord:
MySQLQuery1.Params[I].AsWord := StrToIntDef(ListItem,0);
ftBoolean:
begin
if ListItem = 'True' then
MySQLQuery1.Params[I].AsBoolean := True else
MySQLQuery1.Params[I].AsBoolean := False;
end;
ftFloat:
MySQLQuery1.Params[I].AsFloat := StrToFloat(ListItem);
ftCurrency:
MySQLQuery1.Params[I].AsCurrency := StrToFloat(ListItem);
ftBCD:
MySQLQuery1.Params[I].AsBCD := StrToCurr(ListItem);
ftDate:
MySQLQuery1.Params[I].AsDate := StrToDate(ListItem);
ftTime:
MySQLQuery1.Params[I].AsTime := StrToTime(ListItem);
ftDateTime:
MySQLQuery1.Params[I].AsDateTime := StrToDateTime(ListItem);
end;
end;
end;