Trying to use the TIBCSQL to return value from SQL and it work but the second time I call the function that host the code I get this error:
Dynamic SQL ErrorSQL error code = -804
SQLDA missing or incorrect version, or incorrect number/type of variables.
here is the function code which I founded in the documentation:
Code: Select all
SQL1.SQL.Text := 'Select sum(qty) from mytable where myid = :myID';
SQL1.ParamByName('myID').AsInteger := mastertable.FieldByName('myID').AsInteger;
with TParam(SQL1.Params.Add) do begin
ParamType := ptOutPut;
DataType := ftInteger;
Name := 'Total_Qty';
end;
SQL1.Prepare;
SQL1.Execute;
while SQL1.ExecuteNext do
mytotal := SQL1.ParamByName('Total_Qty').AsInteger;
SQL1.UnPrepare;please advise
Thanks