Try fpc-2.0.4(rc3) On Tue, 2006-08-22 at 18:57 +0200, Zlatko Matić wrote: > Hi! > > I tried to do what you suggested. I set the parameter value first and then > set the property "Active" to true: > > procedure TForm1.FormCreate(Sender: TObject); > var > begin > SQLQuery1.Params.ParamByName('parameter').AsString:='NESTERILNE MASTI, KREME > I GELOVI'; > SQLQuery1.Active:=True; > end; > > I compile it, but when I start my compiled exe, the following error apears: > "PQConnection1: Preparation of query failed (PostgreSQL: ERROR: current > transaction is aborted, commands ignored until end of transaction block). > Press OK to ignore and risk data corruption, press Cancel to kill the > program." > > If I comment the second row (//SQLQuery1.Active:=True;) then there is no > such run-time error... > > Thanks for any help. > > Zlatko > > ----- Original Message ----- > From: "Joost van der Sluis" <[EMAIL PROTECTED]> > To: <lazarus@miraclec.com> > Sent: Monday, August 21, 2006 10:53 PM > Subject: Re: [lazarus] parameterized queries > > > 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