Look in the examples in fcl/db/sqldb/examples (You have to set the value of the parameterer before you can make it active)
On Mon, 2006-08-21 at 18:16 +0200, Zlatko Matić wrote: > Is there any article explaining how to use parameterized queries in > TSQLQuery ? > > ----- Original Message ----- > From: Zlatko Matić > To: lazarus@miraclec.com > Sent: Sunday, August 20, 2006 2:24 PM > Subject: [lazarus] parameterized queries > > > Hello. > > I just tried to put some parameterized query on a form and > pass the parameter's value through code. > The query is the following: > > select distinct sampling_types.sampling_type, > plants.plant, > plants.department > from ((sampling_types join batches_microbs on > (((sampling_types.sampling_type)= > (batches_microbs.sampling_type)))) join plants > on (((batches_microbs.plant) = > (plants.plant)))) > where batches_microbs.sampling_type is not null and > plants.plant_active = true and > plants.plant = :parameter > group by sampling_types.sampling_type, > plants.plant, > plants.user, > plants.plant_active, > plants.plant_report, > plants.department > order by sampling_types.sampling_type, > plants.plant, > plants.department; > > In the query above, ":parameter" should be the > actual parameter. I wanted to pass the parameter's value > through code, in the FormCreate event procedure, something > like this: > SQLQuery1.Params.ParamByName > ('parameter').AsString:='NESTERILNE MASTI, KREME I GELOVI'; > > Well, when I try to set the query to be "Active", the > following error occurs: > "Error. PQConnection1: Unknown fieldtype for parameter > "parameter"." > > What shoudl I do? > > Thanks, > > Zlatko -- Met vriendelijke groeten, Joost van der Sluis CNOC Informatiesystemen en Netwerken http://www.cnoc.nl _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives