Problems with Tparam and TQuery

Hi,
   I use A TQuery created dynamically and 3 TParam also created dynamically.
I will show you a example of my code.
q1: TQuery;
p1, p2: Tparam
q1 := TQuery.create(self);
try
   ...
   p1 := TParam.create(params, ptInput);
   p2 := TParam.create(params, ptInput);
   try
      params[0].name := 'dsdss';
      params[0].datatype := ..
     ...
    Here I put some code and in the finally
  Finally
     p1.free;
      p2.free;   But here a have always an illegal acces memory
  end;

  But when I trace the program all of the params are correctly created.
Could you help me.

And another thing.
Do you know if its possible to set a filter in a table on a field of type
INTEGER.  I have always this error : Operation not applicable.

Thank you
Daniel Bernier