[fpc-pascal] Re: Database parameter trouble in insert query
Reinier Olislagers
reinierolislagers at gmail.com
Sat Sep 7 09:33:21 CEST 2013
On 07/09/2013 09:22, Reinier Olislagers wrote:
> Then looping over the set, I execute it. I thought AssignFromField may
> be appropriate:
> for i := 0 to Source.Fields.Count - 1 do
> begin
> InsertQuery.Params[i].Clear;
> InsertQuery.Params[i].AssignFromField(Source.Fields[i]);
> end;
> InsertQuery.ExecSQL;
>
> The code works mostly, but:
> 1. With Firebird embedded (and BLOB fields) the output seems truncated
> after 1024 bytes
> 2. With ODBC+Access, I get error messages like
> HY104; NativeError: 98; Message: [Microsoft][ODBC Microsoft Access
> Driver]Invalid precision value;
>
Mmmmph. Of course, after sending the post I stumbled on
InsertQuery.Params.CopyParamValuesFromDataset(Source,true);
InsertQuery.ExecSQL
which seems to work ok
More information about the fpc-pascal
mailing list