SQL temp table creation with parameter in FastReport VCL 5

721 Views Asked by At

since several request in my report use the same subquery, I wrote a DBXQuery named qCreateTemp that prepares a temporary table:

CREATE TEMP TABLE temp AS SELECT * FROM acomplexrequest WHERE afield = :avalue 

I defined avalue as an (integer) parameter of the request with value.

First I linked it to a dummy MasterData band, but FastReports complains the request doesn't return a Cursor.

So I tried to call it explicitly from the script code, first simply as:

qCreateTemp.ExecSQL;

Then noticing the request's parameter was not passed, I tried:

qCreateTemp.Params.ParamByName('avalue').Value := <avariable>;
qCreateTemp.ExecSQL;

but I get an error "Could not convert a variant of type (Null) into type (Integer)"

What's the best/correct way to do this ? Thanks !

0

There are 0 best solutions below