Board index » delphi » TIBQuery and Params

TIBQuery and Params

I use a TIBQuery to perform a join SELECT. The query is always the
same and so i set at design time the SQL property to this value:

SELECT *
FROM A JOIN B ON ..
WHERE A.FIELD1 = :Param1
  AND A.FIELD2 = :Param2

Now at runtime i make

      IBSql.Close;
      IBSql.UnPrepare;
      IBSql.ParamByName('Param1').AsInteger := 1
      IBSql.ParamByName('Param2').AsString := 'pippo'
      IBSql.Prepare;
      IBSql.Open;

and this error happens:

  "Dynamic SQL error SQL error code  = -206 Column Unknown"

if at design time i put explicit value i can open the query component
without errors.

Piero - ITALY

 

Re:TIBQuery and Params


Don't unprepare.  IBX knows when it needs to prepare and unprepare and unlike
the BDE you should not need to explicitly prepare or unprepare anything.

Quote
Piero Longhetto wrote:

> I use a TIBQuery to perform a join SELECT. The query is always the
> same and so i set at design time the SQL property to this value:

> SELECT *
> FROM A JOIN B ON ..
> WHERE A.FIELD1 = :Param1
>   AND A.FIELD2 = :Param2

> Now at runtime i make

>       IBSql.Close;
>       IBSql.UnPrepare;
>       IBSql.ParamByName('Param1').AsInteger := 1
>       IBSql.ParamByName('Param2').AsString := 'pippo'
>       IBSql.Prepare;
>       IBSql.Open;

> and this error happens:

>   "Dynamic SQL error SQL error code  = -206 Column Unknown"

> if at design time i put explicit value i can open the query component
> without errors.

> Piero - ITALY

--
Jeff Overcash (TeamB)
      (Please do not email me directly unless  asked. Thank You)
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts, build
a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act
alone, solve equations, analyze a new problem, pitch manure, program a computer,
cook a tasty meal, fight efficiently, die gallantly.  Specialization is for
insects.   (RAH)

Other Threads